简体   繁体   English

如何使用sparql查询从示例owl数据中获取数据

[英]How do get data from example owl data using sparql query

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"/> 因为im rookie with sparql,我想知道怎么做一个查询来获取这个rdf的所有实例<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. nd然后从它获取数据例如get age和get age = 10或获取name和name =“someName” <foaf:age rdf:datatype="http://www.w3.org/2001/XMLSchema#string">10</foaf:age>我的意思是从这一行获取数据。

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. 我对这个问题的回答是:这个查询帮助你找到所有实例,s是对象名,p是这个数据的类型,o是行的值。

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 . 第二部分?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 结果是<http://example.register.nl/nationaalhandelsregister#person1>,10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM