1

我想在我的本体中添加动态信息。我成功添加了这样的东西

<myOntology:Diseases rdf:about="&myOntology;Cough">
  <rdf:type rdf:resource="&myOntology;Diseases" />
</myOntology:Diseases>

INSERT DATA { 
GRAPH <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology>  
   {
    <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology#Cough>             
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
    <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology#Diseases>  
   }
}

但现在我想添加标签或评论属性。例如,要获得

<rdfs:comment xml:lang="en">Cough</rdfs:comment>
<rdfs:comment xml:lang="ro">Tusea</rdfs:comment>

我尝试了很多查询,但没有成功。这样的查询应该是什么?

4

1 回答 1

3

您的插入查询可以通过使用前缀更简洁地编写,并使用a简写 for rdf:type

PREFIX : <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology#>
INSERT DATA { 
GRAPH <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology>
   {
    :Cough a :Diseases
   }
}

要添加其他数据,您只需向图形模式添加更多三元组:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology#>
INSERT DATA { 
GRAPH <http://www.semanticweb.org/alexandrina/ontologies/2013/3/myOntology>
   {
    :Cough a :Diseases ;
           rdfs:label "Cough"@en , "Tusea"@ro .
   }
}

请注意,图形模式

:Cough a :Diseases ;
       rdfs:label "Cough"@en , "Tusea"@ro .

相当于更详细的模式

:Cough a :Diseases .
:Cough rdfs:label "Cough"@en .
:Cough rdfs:label "Tusea"@ro .
于 2013-06-27T17:38:37.840 回答