问题描述
我正在使用Apache Jena,我想从我的RDF数据中查询特定资源。现在,根据下面的RDF文档,我想查询资源Massambala并将其保存到文件中。
所以基本上,本体和资源应该保存到文件中
我应该怎么做?
提前谢谢
以下是我正在研究的模型
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-Syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dados="http://localhost:8080/dados/#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<owl:Class rdf:about="http://localhost:8080/dados/#Fruteiras">
<rdfs:subClassOf>
<owl:Class rdf:about="http://localhost:8080/dados/#Producto"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="http://localhost:8080/dados/#Horticulas">
<rdfs:subClassOf rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:Class>
<owl:Class rdf:about="http://localhost:8080/dados/#Cereais">
<rdfs:subClassOf rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:Class>
<owl:Class rdf:about="http://localhost:8080/dados/#Raizes">
<rdfs:subClassOf rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:Class>
<owl:Class rdf:about="http://localhost:8080/dados/#LeguminosaSEOleaginosas">
<rdfs:subClassOf rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:Class>
<owl:DatatypeProperty rdf:about="http://localhost:8080/dados/#areaColhida">
<rdfs:range>
<xsd:double rdf:about="http://localhost:8080/dados/#hectares">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</xsd:double>
</rdfs:range>
<rdfs:domain rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://localhost:8080/dados/#ano">
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#date"/>
<rdfs:domain rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://localhost:8080/dados/#producao">
<rdfs:range>
<xsd:double rdf:about="http://localhost:8080/dados/#toneladas">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</xsd:double>
</rdfs:range>
<rdfs:domain rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://localhost:8080/dados/#areaSemeada">
<rdfs:range rdf:resource="http://localhost:8080/dados/#hectares"/>
<rdfs:domain rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="http://localhost:8080/dados/#produtividade">
<rdfs:range>
<xsd:double rdf:about="http://localhost:8080/dados/#kilogramasPorHectares">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
</xsd:double>
</rdfs:range>
<rdfs:domain rdf:resource="http://localhost:8080/dados/#Producto"/>
</owl:DatatypeProperty>
<dados:Cereais rdf:about="http://localhost:8080/dados/#Massambala">
<dados:ano>2017/2018</dados:ano>
<dados:produtividade>296</dados:produtividade>
<dados:producao>39363</dados:producao>
<dados:areaColhida>133148</dados:areaColhida>
<dados:areaSemeada>145161</dados:areaSemeada>
</dados:Cereais>
<dados:Raizes rdf:about="http://localhost:8080/dados/#Batata_doce">
<dados:ano>2017/2018</dados:ano>
<dados:produtividade>9663</dados:produtividade>
<dados:producao>1545326</dados:producao>
<dados:areaColhida>159922</dados:areaColhida>
<owl:sameAs rdf:resource="http://dbpedia.org/page/Sweet_potato"/>
<owl:sameAs rdf:resource="http://pt.dbpedia.org/resource/Batata-doce"/>
<owl:sameAs rdf:resource="https://pt.wikipedia.org/wiki/Batata-doce"/>
<dados:areaSemeada>165319</dados:areaSemeada>
</dados:Raizes>
</rdf:RDF>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)