forked from mark-watson/java_practical_semantic_web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsparql_select_test.txt
83 lines (64 loc) · 2.6 KB
/
sparql_select_test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@prefix kb: <http://knowledgebooks.com/> .
kb:oak_creek_flooding kb:storyType kb:disaster ;
kb:summary "Oak Creek flooded last week affecting 5 businesses" ;
kb:title "Oak Creek Flood" .
kb:bear_mountain_fire kb:storyType kb:disaster ;
kb:summary "The fire on Bear Mountain was caused by lightning" ;
kb:title "Bear Mountain Fire" .
kb:trout_season kb:storyType kb:sports , kb:recreation ;
kb:summary "Fishing was good the first day of trout season" ;
kb:title "Trout Season Starts" .
kb:jc_basketball kb:storyType kb:sports ;
kb:summary "Local JC Basketball team lost by 12 points last night" ;
kb:title "Local JC Lost Last Night" .
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?article_uri1 ?article_uri2 ?predicate1 ?predicate2
WHERE {
?article_uri1 ?predicate1 ?same_object .
?article_uri2 ?predicate2 ?same_object .
FILTER (sameTerm(?predicate1, ?predicate2) && !sameTerm(?article_uri1, ?article_uri2)) .
}
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?article_uri1 ?article_uri2 ?predicate1 ?predicate2
WHERE {
?article_uri1 ?predicate1 "Trout Season Starts" .
?article_uri2 ?predicate2 "Trout Season Starts" .
FILTER (!sameTerm(?article_uri1, ?article_uri2)) .
}
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?article_uri1 ?article_uri2 ?predicate1 ?predicate2
WHERE {
?article_uri1 ?predicate1 ?o1 .
?article_uri2 ?predicate2 ?o2 .
FILTER (!sameTerm(?article_uri1, ?article_uri2) && sameTerm(?predicate1, ?predicate2)) .
FILTER regex(?o1, "Season") .
FILTER regex(?o2, "Season") .
}
PREFIX kb:<http://knowledgebooks.com/>
SELECT ?article_uri ?title ?summary
WHERE {
{ ?article_uri kb:storyType kb:sports } UNION { ?article_uri kb:storyType kb:recreation } .
?article_uri kb:title ?title .
?article_uri kb:summary ?summary .
}
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?article_uri ?title ?summary
WHERE {
{ ?article_uri kb:storyType kb:sports } UNION { ?article_uri kb:storyType kb:recreation } .
?article_uri kb:title ?title .
?article_uri kb:summary ?summary .
}
# new triple, without a summary:
kb:jc_bowling kb:storyType kb:sports ;
kb:title "JC Bowling Team to Open Season" .
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?title ?summary
WHERE { ?article_uri kb:title ?title .
OPTIONAL { ?article_uri kb:summary ?summary }
}
PREFIX kb:<http://knowledgebooks.com/>
SELECT DISTINCT ?title ?summary ?page_count
WHERE { ?article_uri kb:title ?title .
OPTIONAL { ?article_uri kb:summary ?summary } .
OPTIONAL { ?article_uri kb:page_count ?page_count . FILTER (?page_count > 1) } .
}