在 Web 注释数据模型中使用 RDF 语句作为正文?

Using RDF statements as body in Web Annotation Data Model?

我正在尝试使用 Web Annotation Data Model (WADM) 在 RDF 语句中添加出处信息。

为了澄清问题,我的 ontology 中的每个 RDF 语句(典型的主谓宾三元组)都是根据特定自由文本片段提供的知识创建的。我想在每个 RDF 语句上创建一个 WADM Annotation,将 RDF 语句本身 作为 Body 并指向相应的自由文本片段作为 Target

我使用 Text Quote Selectors 很清楚指向自由文本片段作为目标。但是,我似乎找不到使用 RDF 语句本身注释自由文本代码的示例。

谁能给我举个例子,说明如何使用 Protege 完成此操作?

WADM 不会限制您 body 可能的情况。根据 anno.jsonldbody 应扩展为 oa:hasBodyoa:hasBodydeclaration不限制其rdfs:range.

oa:hasBody a rdf:Property ;
  rdfs:label "hasBody" ;
  rdfs:domain oa:Annotation ;
  rdfs:isDefinedBy oa: .

因此,您可以使用 rdf:Statement:

{
  "@context": "http://www.w3.org/ns/anno.jsonld" ,
  "id": "http://example.org/annotation12345",
  "type": "Annotation",
  "body": {
    "id": "http://example.org/statement12345",
    "type": "rdf:Statement",
    "rdf:subject": "http://dbpedia.org/resource/Great_Britain",
    "rdf:predicate": "http://dbpedia.org/ontology/capital",
    "rdf:object": "http://dbpedia.org/resource/London"
  },
  "target": {
    "source": "https://en.wikipedia.org/wiki/London",
    "selector": {
      "type": "TextQuoteSelector",
      "exact": "London is a capital of Great Britain",
      "prefix": ". ",
      "suffix": ". "
    }
  }
}


Can anybody point me to an example on how could this be done with Protege?

Protégé 不是 RDF 编辑器。 RDF 是 OWL 序列化的抽象语法。 JSON-LD 可用作 RDF 序列化的具体语法。

但是,如果你想使用Protégé作为RDF编辑器,下面的ontology将被序列化为类似于JSON-LD上面的JSON-LD:

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#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: dbr: <http://dbpedia.org/resource/>
Prefix: dbo: <http://dbpedia.org/ontology/>
Prefix: oa: <http://www.w3.org/ns/oa#>
Prefix: ex: <http://example.org/>

Ontology: <http://example.org/>

# Import: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
# Import: <http://www.w3.org/ns/oa#>

ObjectProperty: oa:hasBody
ObjectProperty: oa:hasTarget
ObjectProperty: oa:hasSelector

DataProperty: oa:hasSource
DataProperty: oa:prefix
DataProperty: oa:exact
DataProperty: oa:suffix

ObjectProperty: rdf:subject
ObjectProperty: rdf:object
ObjectProperty: rdf:predicate  


Class: oa:Annotation  
Class: oa:TextQuoteSelector
Class: rdf:Statement

Individual: ex:annotation12345
    Facts:
        oa:hasBody ex:statement12345,
        oa:hasTarget ex:target12345
    Types: 
        oa:Annotation

Individual: ex:statement12345
    Facts: 
        rdf:object dbr:London,
        rdf:predicate dbo:capital,
        rdf:subject dbr:Great_Britain
    Types: 
        rdf:Statement

Individual: ex:target12345
    Facts: 
        oa:hasSelector ex:selector12345,
        oa:hasSource "https://en.wikipedia.org/wiki/London"

Individual: ex:selector12345
    Facts: 
        oa:suffix ". ",
        oa:prefix ". ",
        oa:exact "London is a capital of Great Britain"
    Types:
        oa:TextQuoteSelector

Individual: dbo:capital
Individual: dbr:Great_Britain
Individual: dbr:London

有很多限制。例如,在上面的 ontology 中,您的 RDF 语句的对象不能是文字。如果将 rdf:object 声明为数据类型 属性,它们可以是文字,但它们不能是具有 URI 的对象。此限制的原因是 Protégé 不是 OWL 完整编辑器,而是 OWL 2 DL 编辑器。

作为解决方法,您可以声明并使用 rdf:subjectrdf:objectrdf:predicate 作为注释属性:

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#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: dbr: <http://dbpedia.org/resource/>
Prefix: dbo: <http://dbpedia.org/ontology/>
Prefix: oa: <http://www.w3.org/ns/oa#>
Prefix: ex: <http://example.org/>

Ontology: <http://example.org/>

# Import: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
# Import: <http://www.w3.org/ns/oa#>

ObjectProperty: oa:hasBody
ObjectProperty: oa:hasTarget
ObjectProperty: oa:hasSelector

DataProperty: oa:hasSource
DataProperty: oa:prefix
DataProperty: oa:exact
DataProperty: oa:suffix

AnnotationProperty: rdf:subject
AnnotationProperty: rdf:object
AnnotationProperty: rdf:predicate     

Class: oa:Annotation  
Class: oa:TextQuoteSelector
Class: rdf:Statement

Individual: ex:annotation12345
    Facts:
        oa:hasBody ex:statement12345,
        oa:hasTarget ex:target12345
    Types: 
        oa:Annotation

Individual: ex:statement12345
    Annotations: 
        rdf:object dbr:London,
        rdf:predicate dbo:capital,
        rdf:subject dbr:Great_Britain
    Types: 
        rdf:Statement

Individual: ex:target12345
    Facts: 
        oa:hasSelector ex:selector12345,
        oa:hasSource "https://en.wikipedia.org/wiki/London"

Individual: ex:selector12345
    Facts: 
        oa:suffix ". ",
        oa:prefix ". ",
        oa:exact "London is a capital of Great Britain"
    Types:
        oa:TextQuoteSelector

Individual: dbo:capital
Individual: dbr:Great_Britain
Individual: dbr:London


我想我通过使用 "hasTarget" 作为注释 属性.

注释语句(例如 ObjectPropertyAssertion)找到了一个解决方法

例如,如果我想使用 RDF 语句 <Subject, Property, Object> 来注释位于 Internet 某处的目标 pdf,我将使用以下基本原理:

<ObjectPropertyAssertion>
        <Annotation>
            <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasTarget"/>
            <AnonymousIndividual nodeID="_:genid-f7b71d4c-657e-40bc-bc69-31fc3af8b603"/>
        </Annotation>
        <ObjectProperty IRI="<Predicate>"/>
        <NamedIndividual IRI="<Subject>"/>
        <NamedIndividual IRI="<Object>"/>
</ObjectPropertyAssertion>

<AnnotationAssertion>
    <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasSource"/>
    <AnonymousIndividual nodeID="_:genid-0d456ba2-52b9-470d-ad70-efafbc06d261"/>
    <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#anyURI">source_url</Literal>
</AnnotationAssertion>

<ObjectPropertyAssertion>
        <ObjectProperty IRI="http://www.w3.org/ns/oa#hasSelector"/>
        <AnonymousIndividual nodeID="_:genid-f7b71d4c-657e-40bc-bc69-31fc3af8b603"/>
        <NamedIndividual IRI="#selector_1"/>
</ObjectPropertyAssertion>

<ClassAssertion>
        <Class IRI="http://www.w3.org/ns/oa#TextQuoteSelector"/>
        <NamedIndividual IRI="#selector_1"/>
</ClassAssertion>

<DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#exact"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some text</Literal>
</DataPropertyAssertion>

 <DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#prefix"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some prefix</Literal>
</DataPropertyAssertion>

<DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#suffix"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some suffix</Literal>
</DataPropertyAssertion>

可以通过在每个 属性 断言(即原始 <Subject, Property, Object> 语句)的右侧使用“@”符号注释语句来在 "Property assertions" 查看。

我不太确定它是否完全合规,但我觉得还可以。

希望对其他人也有帮助。

编辑:示例 ontology 的完整版本,按要求由 protege 以 OWL/XML 格式直接制作。

<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
     xml:base="http://www.semanticweb.org/example"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     ontologyIRI="http://www.semanticweb.org/example">
    <Prefix name="" IRI="http://www.semanticweb.org/example"/>
    <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
    <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
    <Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
    <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
    <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
    <Import>http://www.w3.org/ns/oa#</Import>
    <Declaration>
        <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasSource"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="http://www.w3.org/ns/oa#hasSelector"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#exampleIndividual2"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="http://www.w3.org/ns/oa#prefix"/>
    </Declaration>
    <Declaration>
        <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasTarget"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="http://www.w3.org/ns/oa#suffix"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#exampleIndividual"/>
    </Declaration>
    <Declaration>
        <NamedIndividual IRI="#selector_1"/>
    </Declaration>
    <Declaration>
        <DataProperty IRI="http://www.w3.org/ns/oa#exact"/>
    </Declaration>
    <Declaration>
        <ObjectProperty IRI="#exampleProperty"/>
    </Declaration>
    <ClassAssertion>
        <Class IRI="http://www.w3.org/ns/oa#TextQuoteSelector"/>
        <NamedIndividual IRI="#selector_1"/>
    </ClassAssertion>
    <ObjectPropertyAssertion>
        <Annotation>
            <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasTarget"/>
            <AnonymousIndividual nodeID="_:genid36"/>
        </Annotation>
        <ObjectProperty IRI="#exampleProperty"/>
        <NamedIndividual IRI="#exampleIndividual2"/>
        <NamedIndividual IRI="#exampleIndividual"/>
    </ObjectPropertyAssertion>
    <ObjectPropertyAssertion>
        <ObjectProperty IRI="http://www.w3.org/ns/oa#hasSelector"/>
        <AnonymousIndividual nodeID="_:genid36"/>
        <NamedIndividual IRI="#selector_1"/>
    </ObjectPropertyAssertion>
    <DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#exact"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some text</Literal>
    </DataPropertyAssertion>
    <DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#prefix"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some prefix</Literal>
    </DataPropertyAssertion>
    <DataPropertyAssertion>
        <DataProperty IRI="http://www.w3.org/ns/oa#suffix"/>
        <NamedIndividual IRI="#selector_1"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">some suffix</Literal>
    </DataPropertyAssertion>
    <AnnotationAssertion>
        <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasSource"/>
        <AnonymousIndividual nodeID="_:genid36"/>
        <Literal datatypeIRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">source_url</Literal>
    </AnnotationAssertion>
    <AnnotationAssertion>
        <AnnotationProperty IRI="http://www.w3.org/ns/oa#hasSource"/>
        <AnonymousIndividual nodeID="_:genid37"/>
        <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#anyURI">source_url</Literal>
    </AnnotationAssertion>
</Ontology>



<!-- Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi -->