php - 如何将新的命名个人添加到 XML/RDF owl 文件?
问题描述
我正在使用 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>
解决方案
考虑使用 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,您可能正在使用一些工具,确定哪些工具可以让我们更轻松地为您提供帮助。
推荐阅读
- android - 插页式视频广告显示后 Exoplayer 播放错误
- android - 没有“请勿打扰”的静音电话
- javascript - 使用返回的 id 创建的文档但在数据库 Firebase 和 Vue.js 中找不到
- android-studio - 如何在 Kotlin 中的按钮前面显示图像视图?
- amazon-web-services - 当只有 1 个 IAM 用户可以访问 S3 存储桶时,我是否需要启用公共访问?
- c++ - 二进制“=”:未找到采用右手操作数的运算符(或没有可接受的对话)
- java - 我需要将此休眠表表示为 mysql 表
- ios - 使用 iwatch 快速提取心率代码
- plot - 从最近的错误值绘制时间序列价格范围日期与日期时间框架不匹配
- shinyapps - 如何为闪亮的应用程序制作安装文件?