如何使用 SPARQL 构建 owl:Restriction
How to use SPARQL to CONSTRUCT owl:Restriction
我正在尝试对 ontology 中的某些实例创建 OWL 限制。这些实例通过 rdf:type
关系关联到 类,而它们应该是某种 owl 限制。为了解决这个问题,我创建了一个 CONSTRUCT
语句:
PREFIX myontology:<http://myontology.org/myonto/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
CONSTRUCT {
?entity rdf:type ?owlRestriction .
?owlRestriction a owl:Restriction .
?owlRestriction owl:onProperty myontology:someRelation .
?owlRestriction owl:someValuesFrom ?someClass .
}
WHERE {
?owlRestriction a owl:Restriction .
?entity a ?class .
?class rdfs:subClassOf* myontology:someSuperClass .
}
当我 运行 但是,创建的限制包括 myontology:someSuperClass
下的每个子类。我如何更改上述查询,以便只有通过 rdf:type
与我的实例直接相关的 类 更改为限制?
感谢您的帮助!
此 CONSTRUCT
查询适当地创建了 owl:Restriction
关系:
PREFIX myontology:<http://myontology.org/myonto/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
CONSTRUCT {
?entity a [rdf:type owl:Restriction ;
owl:onProperties myontology:myrelation;
owl:someValuesFrom ?class] .
}
WHERE {
?entity a ?class .
?class rdfs:subClassOf* myontology:someSuperClass .
}
我正在尝试对 ontology 中的某些实例创建 OWL 限制。这些实例通过 rdf:type
关系关联到 类,而它们应该是某种 owl 限制。为了解决这个问题,我创建了一个 CONSTRUCT
语句:
PREFIX myontology:<http://myontology.org/myonto/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
CONSTRUCT {
?entity rdf:type ?owlRestriction .
?owlRestriction a owl:Restriction .
?owlRestriction owl:onProperty myontology:someRelation .
?owlRestriction owl:someValuesFrom ?someClass .
}
WHERE {
?owlRestriction a owl:Restriction .
?entity a ?class .
?class rdfs:subClassOf* myontology:someSuperClass .
}
当我 运行 但是,创建的限制包括 myontology:someSuperClass
下的每个子类。我如何更改上述查询,以便只有通过 rdf:type
与我的实例直接相关的 类 更改为限制?
感谢您的帮助!
此 CONSTRUCT
查询适当地创建了 owl:Restriction
关系:
PREFIX myontology:<http://myontology.org/myonto/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
CONSTRUCT {
?entity a [rdf:type owl:Restriction ;
owl:onProperties myontology:myrelation;
owl:someValuesFrom ?class] .
}
WHERE {
?entity a ?class .
?class rdfs:subClassOf* myontology:someSuperClass .
}