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 10 added one line
At line 14 removed one line
! Classes
At line 16 added 2 lines
! Classes
At line 20 changed one line
rdfs:label "Lebewesen"@de, "Living being"@en.
rdfs:label "Lebewesen"@de, "Living being".
At line 26 added one line
a rdfs:Class;
At line 68 added one line
At line 148 added one line
At line 160 added one line
At line 186 changed one line
si:sibling si:lisa, si:maggie ;
si:sibling si:lisa ;
At line 250 removed one line
!!! Sample Queries
At line 252 changed one line
Ok, we can test/query the ontology by inserting some SPARQL statements.
%%SparqlVisualization
At line 254 changed one line
! Simple start
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 256 removed 7 lines
Show me all instances of Human and also show their labels.
%%Sparql
SELECT ?x ?name
WHERE {
?x rdf:type si:Human ;
rdfs:label ?name .
At line 264 changed 3 lines
@border: true
@zebramode: true
@showQuery: true
@rankDir: BT
@size: 1200
At line 269 removed one line
! Barts Grand-Pa
At line 271 removed 95 lines
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 ?husband
WHERE {
?husband si:father ?kid ;
rdfs:label ?name .
?wife si:husband ?husband .
}
@border: true
@zebramode: true
@showQuery: true
%
! Hierarchical Table
%%Sparql
SELECT (SAMPLE(?sub) as ?sub) (SAMPLE(?par) as ?par) (SAMPLE(?name) as ?name) ?concept
WHERE {
{
# bind si:abraham as root node
BIND (si:abraham as ?sub) .
}
UNION
{
# collect all parent child relations (will be conntected automagically to si:abraham)
?sub si:parent ?par ;
}
# display name and concept as table columns
?sub rdfs:label ?name .
BIND (?sub as ?concept) .
} GROUP BY ?concept
@tree: true
@showQuery: true
%
At line 376 changed one line
@ruleset: OWL_HORST_OPTIMIZED_WITH_PROPERTY_CHAINS
@ruleset: OWL2_RL_REDUCED_OPTIMIZED
At line 379 changed one line
Let's use the namespace {{si}} for the resources.
Let's us the namespace {{si}} for the resources.