2017-09-08 47 views
1

我試圖使用Web Annotation Data Model (WADM)爲了添加RDF語句的出處信息。在Web Annotation Data Model中使用RDF語句作爲主體?

爲了澄清的事情,每一個RDF陳述(典型的主謂對象三元組)在我的本體論基礎上提供了具體的自由文本片段的知識被創造。我想每個RDF語句創建一個WADM Annotation,具有RDF語句本身Body和指向各自的自由文本片段作爲Target

指着自由文本片段作爲目標使用Text Quote Selectors我很清楚。但是,我似乎無法找到使用RDF語句本身註釋自由文本代碼的示例。

任何人都可以點我就怎麼會這樣與門徒做了一個例子嗎?

回答

1

我想我找到了一個解決方法通過註釋語句(例如ObjectPropertyAssertion )使用「hasTarget」作爲註釋屬性進行註釋。

例如,如果我想使用RDF聲明<Subject, Property, Object>註釋位於互聯網的某個地方的目標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>語句),在「屬性斷言」視圖中。

我不太確定它是否完全兼容,但對我來說似乎還行。

希望這對他人也有幫助。

編輯:按照要求,完整版本的示例本體,由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 --> 
1

WADM不會限制你在什麼body可能。根據anno.jsonld,body應擴大到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": ". " 
    } 
    } 
} 


任何人都可以點我就怎麼會這樣與門徒做了一個例子嗎?

門徒新不是一個RDF編輯器。 RDF是OWL序列化的抽象語法。 JSON-LD可能被用作RDF序列化的具體語法。

然而,如果你想使用門徒新作爲RDF編輯,本體下方將序列化爲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 

有許多限制。例如,在上面的本體中,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 


Individual views

+0

非常感謝您的回答。我想我找到了一個更簡單的解決方案。你認爲我提議的是有效的嗎? –

+0

@PantelisNatsiavas,請在您的答案中粘貼完整的本體論,最好是曼徹斯特語法。 –

+0

我剛剛上傳了一個使用OWL/XML格式的完整示例,可以直接導出。不幸的是,protege無法成功導出曼徹斯特語法中的示例,因爲它嚴重依賴未聲明的實體(隱含目標)的註釋屬性,並且我收到消息「曼徹斯特OWL語法可能會丟失信息,例如GCI和未聲明實體的註釋」 –

相關問題