-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdbpedia-examples.sh
27 lines (22 loc) · 1008 Bytes
/
dbpedia-examples.sh
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
# DBPedia Examples
# ---
# These all use pq-dbpedia in the bin/ directory, which is a one-line wrapper onto pl2sparql,
# which loads the dbpedia.pl module and sets the endpoint to http://dbpedia.org/sparql/
# ---
# movies directors with children who are musicians
# ---
# this example uses bare rdf/3 predicates
pq-dbpedia "rdf(F,dbo:director,D),rdf(D,dbo:child,C),rdfs_individual_of(C,dbo:'MusicalArtist')"
# ---
# movies directors with children who are musicians
# ---
# use convenience predicates
pq-dbpedia "has_director(F,D),child(D,C),musical_artist(C)"
# ---
# examples of JOINs
# ---
# outer loop over all cities, querying each one for its label
# (this is an example: don't do this as it is inefficient)
pq-dbpedia "rdf(City,rdf:type,dbont:'City') join label(City,CityLabel),lang(CityLabel)=\"en\""
# bands with a city in their name; we do this via looping rather than single query
pq-dbpedia "city(C),label(C,CN),lang(CN)=\"en\",bind(str(CN),CNS) join band(B),label(B,BN),contains(BN,CNS)"