Sparql学习

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX on:<http://www.semanticweb.org/dell/ontologies/2018/7/untitled-ontology-19#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/#>
Select ?p 
where {?p rdfs:subClassOf*  on:Animal. }

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>类似于import XX as RDF

网址就是类似neo4j中的id  rdfs:subClassOf 表示http://www.w3.org/1999/02/22-rdf-syntax-ns/subClassOf这个资源

PREFIX on:<http://www.semanticweb.org/dell/ontologies/2018/7/untitled-ontology-19#>

这样on就表示新建的本体库的资源网址。

xsd表示类型约束,number类型还是string类型以及其他类型 

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> rdf表示类型

PREFIX owl: <http://www.w3.org/2002/07/owl#>表示类别

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX on:<http://www.semanticweb.org/dell/ontologies/2018/7/untitled-ontology-19#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/#>
Select ?p
where {?p  rdf:type owl:Class}

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX on:<http://www.semanticweb.org/dell/ontologies/2018/7/untitled-ontology-19#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/#>
select ?s
where{
  ?s  owl:disjointWith  on:Plant.

查找实例与实例之间自定义的关系:

 

查找实例中的属性值

查找类的实例

 

猜你喜欢

转载自blog.csdn.net/baidu_15113429/article/details/82251062