在Web Annotation Data Model中使用RDF语句作为主体?

时间:2017-09-08 12:12:12

标签: rdf semantic-web protege

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

为了澄清事情,我的本体中的每个RDF语句(典型的主语 - 谓语 - 对象三元组)都是基于特定自由文本片段提供的知识创建的。我想在每个RDF语句上创建一个WADM Annotation,将 RDF语句本身作为Body,并将相应的自由文本片段指向{{1} }。

使用Text Quote Selectors,我可以清楚地看到将自由文本片段作为目标。但是,我似乎无法找到一个用RDF语句本身注释自由文本代码的例子。

有人能指出一个关于如何用Protege做到这一点的例子吗?

2 个答案:

答案 0 :(得分:1)

WADM不会限制你 var videoYoutube = $(this).attr('data-ytlink'); 的内容。根据{{​​3}},body应扩展为bodyoa:hasBody的{​​{3}}不会限制其oa:hasBody

rdfs:range

因此,您可以使用anno.jsonld

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

有人能指出一个关于如何用Protege做到这一点的例子吗?

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

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

{
  "@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语句的对象不能是文字。如果将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 声明为数据类型属性,则它们可以是文字,但是它们不能是具有URI的对象。这种限制的原因是Protégé不是OWL Full编辑器,而是OWL 2 DL编辑器。

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

rdf:predicate


declaration

答案 1 :(得分:1)

我认为我通过使用&#34; hasTarget&#34;注释带有注释的语句(例如ObjectPropertyAssertion)找到了一种解决方法。作为注释属性。

例如,如果我想使用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>

可以通过使用&#34; @&#34;注释语句来保护它。每个属性断言右侧的符号(即原始<Subject, Property, Object>语句),在&#34;属性断言&#34;图。

我不确定它是否完全符合,但对我来说似乎没问题。

希望它对其他人也有帮助。

编辑:根据请求,完整版本的示例本体,由OWL / XML格式的protege直接生成。

<?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 -->