0

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.

user3699711
  • 49
  • 1
  • 8
  • and you did not read any SPARQL tutorial I guess? – UninformedUser Apr 23 '19 at 19:04
  • SPARQL = query language for RDF. You can serialize OWL data as RDF triples. Ideally, you look at your data in N-Triples or even better Turtle syntax. SPARQL syntax is close to it. – UninformedUser Apr 23 '19 at 19:06
  • I'll give you an entry point, the rest is your task, because you have to learn it by yourself: `select ?s where {?s rdf:type }` - this will return all persons (don't forget to add the prefix declaration for `rdf` or just use `a` instead of `rdf:type`) – UninformedUser Apr 23 '19 at 19:08
  • 1
    I read SPARQL tutorial, but i didnt get it right away, ohh tnx m8, that resolved my problem :) – user3699711 Apr 23 '19 at 19:17
  • once you got the full query working, don't forget to post it as an answer here. – UninformedUser Apr 23 '19 at 19:21

1 Answers1

0

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

user3699711
  • 49
  • 1
  • 8