This is my example owl :
<rdf:type rdf:resource="http://www.w3.org/2000/10/swap/pim/contact#Person"/>
<foaf:age rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10</foaf:age>
<foaf:birthday rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10.10</foaf:birthday>
<foaf:firstName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Liis</foaf:firstName>
</owl:NamedIndividual>
And because im rookie with sparql, i want to know how do make a query to get all instances with this rdf a <rdf:type rdf:resource="http://www.w3.org/2000/10/swap/pim/contact#Person"/>
nd then get the data from it example like get age and the get age=10 or get name and name="someName" <foaf:age rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10</foaf:age>
i mean get data from this row.
My answares to this question are: This query help you to find all instances, s is the object name, p is the type how do accsess to this data and o is the value of the row.
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX resource: <http://purl.org/vocab/resourcelist/schema#>
select distinct ?s ?p ?o ?k where {
?s ?p ?o ;
a <http://www.w3.org/2000/10/swap/pim/contact#Person> .
?k foaf:age ?x .}
and the second part ?k foaf:age ?x .
is how do accsess to instance data by the type name. and the result is <http://example.register.nl/nationaalhandelsregister#person1>,10
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.