如何将新的具名个人添加到XML / RDF猫头鹰文件?

问题描述 投票:0回答:1

我正在与Apache Jena Fuseki合作。我必须从php网页上获取一些变量,并将其发送到apache jena fuseki sparql表格。

我想在本体中插入新个体?但是我对此一无所知。这是我文件的一部分。我想用sparql查询插入另一个这样的人吗?

<rdf:RDF xmlns="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#"
 xml:base="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2"
 xmlns:owl="http://www.w3.org/2002/07/owl#"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:uni="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#"
 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#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2"/>

 <owl:NamedIndividual rdf:about="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#Student1">
    <rdf:type rdf:resource="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#Student"/>
    <studies rdf:resource="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#CS101"/>
    <studies rdf:resource="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#M201"/>
    <studies rdf:resource="http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#M204"/>
    <first_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Josef</first_name>
    <last_name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Baker</last_name>
    <studentID rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">266814</studentID>
</owl:NamedIndividual>
php sparql jena fuseki
1个回答
0
投票

考虑使用Turtle代替RDF / XML ...

这里是您当前的数据,已转换为-

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix ns0: <http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2> 
   a               owl:Ontology .

<http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#Student1>
   a               owl:NamedIndividual , 
                   <http://www.semanticweb.org/ozgur/ontologies/2019/9/untitled-ontology-2#Student> ;
   ns0:studies     ns0:CS101 , 
                   ns0:M201 , 
                   ns0:M204 ;
   ns0:first_name  "Josef"^^xsd:string ;
   ns0:last_name   "Baker"^^xsd:string ;
   ns0:studentID   266814 .

[我敢打赌,您可以看到复制“ Josef”,“ Baker”个人的节,然后将其编辑为与“ Josefine”,“ Chef”有关的内容是多么容易……

如果确实需要使用SPARQL,则可能正在使用某些工具,确定哪些工具将使我们明显地更容易为您提供帮助。

© www.soinside.com 2019 - 2024. All rights reserved.