作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试查询与类/个人相关的所有 AnnotationAssertion。
下面是我的来源片段:
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<IRI>#Car</IRI>
<Literal xml:lang="en" datatypeIRI="&rdf;PlainLiteral">A car has four tyres</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty IRI="http://www.w3.org/2004/02/skos/core#definition"/>
<IRI>#car</IRI>
<Literal xml:lang="en" datatypeIRI="&rdf;PlainLiteral">a road vehicle, typically with four wheels, powered by an internal combustion engine and able to carry a small number of people.</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty IRI="http://www.w3.org/2004/02/skos/core#example"/>
<IRI>#car</IRI>
<Literal xml:lang="en" datatypeIRI="&rdf;PlainLiteral">Audi</Literal>
</AnnotationAssertion>
etc..
我正在尝试查询与此类/个体关联的 AnnotationProperties 及其 AnnotationAssertions 列表。
SPARQL-DL API提供通过
查询注释属性的可能性Annotation(a, b, c)
任何查询 AnnotationAssertions 的指针都会非常有帮助。
最佳答案
您在问题中提到了 SPARQL-DL,但这也被标记为 sparql ,并且简单的 SPARQL 中的答案并不太复杂。这将类似于:
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?s ?p ?o where {
?s ?p ?o .
?p a owl:AnnotationProperty .
}
但是,您在这里可能遇到的困难是,可能并非每个注释属性都被实际声明。这会让事情变得更加困难,但是您可以通过询问所有三元组来尝试解决这个问题,除了那些属性是已知的 ObjectProperty 或 DatatypeProperty 的三元组,以及那些在 OWL 到 RDF 映射中使用的三元组(以 rdf 开头的属性:或 owl: 和某些 rdfs: 属性)。例如,
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?s ?p ?o where {
?s ?p ?o .
#-- don't include object or datatype properties
filter not exists {
values ?type { owl:ObjectProperty owl:DatatypeProperty }
?p a ?type
}
#-- don't include properties from rdf: or owl: namespaces
filter( !strstarts( str(?p), str(rdf:) ) )
filter( !strstarts( str(?p), str(owl:) ) )
#-- don't include rdfs: properties used in OWL to RDF mapping
filter( ?p not in ( rdfs:range, rdfs:domain, rdfs:subClassOf, rdfs:subPropertyOf ) )
}
关于java - 查询所有 "AnnotationAssertions"的类(class)/个人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26656608/
我有一个像这样的 .owl 文件: ... ... #bf1badca Remove_old_books 我想要得到的是在注释断言 (#bf1ba
我正在尝试查询与类/个人相关的所有 AnnotationAssertion。 下面是我的来源片段: #Car
我是一名优秀的程序员,十分优秀!