This page (revision-64) was last changed on 05-May-2021 20:05 by Albrecht Striffler

This page was created on 24-Jun-2014 12:41 by Joba Baumeister

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
64 05-May-2021 20:05 7 KB Albrecht Striffler to previous
63 05-May-2021 20:04 7 KB Albrecht Striffler to previous | to last
62 09-Dec-2019 14:24 7 KB Albrecht Striffler to previous | to last
61 09-Dec-2019 14:23 7 KB Albrecht Striffler to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 257 changed one line
!!! Sample Queries
%%SparqlVisualization
At line 259 changed one line
Ok, we can test/query the ontology by inserting some SPARQL statements.
SELECT ?x ?y ?z WHERE {
?x ?y ?z .
FILTER (STRSTARTS(STR(?x), "http://www.example.org/ontology#")).
FILTER (STRSTARTS(STR(?z), "http://www.example.org/ontology#")).
FILTER NOT EXISTS {?x rdf:type rdfs:Class}.
FILTER NOT EXISTS {?z rdf:type rdfs:Class}.
FILTER NOT EXISTS {?x rdf:type rdf:Property}.
FILTER NOT EXISTS {?z rdf:type rdf:Property}.
FILTER (?y != si:relatedWith).
FILTER (?y != si:parent).
FILTER (?y != si:child).
FILTER (?y != si:grandparent).
FILTER (?z != ?x).
At line 261 removed 10 lines
! Simple start
Show me all instances of Human and also show their labels.
%%Sparql
SELECT ?x ?name
WHERE {
?x rdf:type si:Animal ;
rdfs:label ?name .
At line 272 changed 3 lines
@border: true
@zebramode: true
@showQuery: true
@rankDir: BT
@size: 1200
At line 278 removed 79 lines
! Barts Grand-Pa
Use property paths in SPARQL.
%%Sparql
SELECT ?name
WHERE {
si:bart si:father/si:father ?name .
}
@border: true
@zebramode: true
@showQuery: true
%
Now using a defined PropertyChain
%%Sparql
SELECT ?name
WHERE {
si:bart si:grandparent ?name .
}
@border: true
@zebramode: true
@showQuery: true
%
! Optional belongings
We also can add optional patterns into the query. Show all humans and their (optional) belongings.
%%Sparql
SELECT ?name ?belonging
WHERE {
?x rdf:type si:Human ;
rdfs:label ?name .
OPTIONAL { ?x si:owns/si:ownType/rdfs:label ?belonging } .
}
@border: true
@zebramode: true
@showQuery: true
%
! UNION: All names of humans and animals
%%Sparql
SELECT ?name
WHERE {
{ ?x rdf:type si:Human ;
rdfs:label ?name .
} UNION {
?x rdf:type si:Animal ;
rdfs:label ?name .
}
}
@border: true
@zebramode: true
@showQuery: true
%
! Expected Compentency Questions: Intersecting Properties
The family father: A father that is also a husband
%%Sparql
SELECT ?name
WHERE {
?husband si:father ?kid ;
rdfs:label ?name .
?wife si:husband ?husband .
}
@border: true
@zebramode: true
@showQuery: true
%