fix paren
[arxana.git] / elisp / search-convenience.el
blob4833367808c99540979414966558d38e240e6ac3
1 (defun triples-given-beginning (node)
2 "Get triples outbound from the given NODE."
3 ;; (search `(((a ,node))
4 ;; ((c src a)
5 ;; (c snk b))))
6 (filter-plexus
7 (lambda (id)
8 (and (equal (get-content (get-source id) node))
9 (ground-p (get-source (get-source id)))
10 (ground-p (get-source (get-sink id)))
11 (ground-p (get-sink (get-source id)))
12 (ground-p (get-sink (get-sink id)))))))
14 (defun triples-given-end (node)
15 "Get triples inbound into NODE."
16 ;; (search `(((b ,node))
17 ;; ((c src a)
18 ;; (c snk b))))
19 (filter-plexus
20 (lambda (id)
21 (and (equal (get-content (get-sink id) node))
22 (ground-p (get-source (get-source id)))
23 (ground-p (get-source (get-sink id)))
24 (ground-p (get-sink (get-source id)))
25 (ground-p (get-sink (get-sink id)))))))
27 (defun triples-given-middle (edge)
28 "Get the triples that run along EDGE."
29 ;; (search `(((c ,edge))
30 ;; ((c src a)
31 ;; (c snk b))))
32 (filter-plexus
33 (lambda (id)
34 (and (equal (get-content id) edge)
35 (ground-p (get-source (get-source id)))
36 (ground-p (get-source (get-sink id)))
37 (ground-p (get-sink (get-source id)))
38 (ground-p (get-sink (get-sink id)))))))
40 (defun triples-given-middle-and-end (edge node)
41 "Get the triples that run along EDGE into NODE."
42 ;; (search `(((c ,edge) (b ,node))
43 ;; ((c src a)
44 ;; (c snk b))))
45 (filter-plexus
46 (lambda (id)
47 (and (equal (get-content id) edge)
48 (equal (get-content (get-sink id) node))
49 (ground-p (get-source (get-source id)))
50 (ground-p (get-source (get-sink id)))
51 (ground-p (get-sink (get-source id)))
52 (ground-p (get-sink (get-sink id)))))))
54 (defun triples-given-beginning-and-middle (node edge)
55 "Get the triples that run from NODE along EDGE."
56 ;; (search `(((a ,node) (c ,edge))
57 ;; ((c src a)
58 ;; (c snk b))))
59 (filter-plexus
60 (lambda (id)
61 (and (equal (get-content (get-source id) node))
62 (equal (get-content id) edge)
63 (ground-p (get-source (get-source id)))
64 (ground-p (get-source (get-sink id)))
65 (ground-p (get-sink (get-source id)))
66 (ground-p (get-sink (get-sink id)))))))
68 (defun triples-given-beginning-and-end (node1 node2)
69 "Get the triples that run from NODE1 to NODE2. Optional
70 argument VIEW causes the results to be selected
71 into a view with that name."
72 ;; (search `(((a ,node1) (b ,node2))
73 ;; ((c src a)
74 ;; (c snk b))))
75 (filter-plexus
76 (lambda (id)
77 (and (equal (get-content (get-source id) node1))
78 (equal (get-content (get-sink id) node2))
79 (ground-p (get-source (get-source id)))
80 (ground-p (get-source (get-sink id)))
81 (ground-p (get-sink (get-source id)))
82 (ground-p (get-sink (get-sink id)))))))
84 (defun triple-exact-match (node1 edge node2)
85 "Get the triples that run from NODE1 along EDGE to
86 NODE2."
87 ;; (search `(((a ,node1) (b ,node2) (c ,edge))
88 ;; ((c src a)
89 ;; (c snk b))))
90 (filter-plexus
91 (lambda (id)
92 (and (equal (get-content (get-source id) node1))
93 (equal (get-content id) edge)
94 (equal (get-content (get-sink id) node2))
95 (ground-p (get-source (get-source id)))
96 (ground-p (get-source (get-sink id)))
97 (ground-p (get-sink (get-source id)))
98 (ground-p (get-sink (get-sink id)))))))