jena

How to add vocabulary in Jena?

岁酱吖の 提交于 2021-02-19 08:49:07
问题 In Jena there are some default ontologies like RDF, FOAF... So we can add property to resource like: resource.addProperty(FOAF.name, person.getMFirstName()); But I need another ontology that does not exist in Jena like SIOC, pimo that I have the URI for. How can I do this? 回答1: Jena has a tool for generating Java classes that contain the constants from ontologies and RDF schemas: schemagen 来源: https://stackoverflow.com/questions/5979747/how-to-add-vocabulary-in-jena

How to clone or copy a Jena-Ontology-Model (OntModel) to apply temporary changes?

浪尽此生 提交于 2021-02-19 03:58:13
问题 I've been searching for a solution for days now and since there is no forum at Apache Jena I had to create an account at stackoverflow to ask. My problem is that I need a temporary (deep) copy of an already loaded ontology, namely an object of OntModelImpl (with some imports but without any attached inference machine). Its purpose is to apply some validation steps on the model which require some SPARQL UPDATE queries to add some automatically generated triples first. These additional triples

RDFS, Jena: how to query taking ontology into account

被刻印的时光 ゝ 提交于 2021-02-10 19:12:14
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

RDFS, Jena: how to query taking ontology into account

风流意气都作罢 提交于 2021-02-10 19:12:00
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

RDFS, Jena: how to query taking ontology into account

跟風遠走 提交于 2021-02-10 19:11:25
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

RDFS, Jena: how to query taking ontology into account

三世轮回 提交于 2021-02-10 19:10:58
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

RDFS, Jena: how to query taking ontology into account

此生再无相见时 提交于 2021-02-10 19:10:40
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

RDFS, Jena: how to query taking ontology into account

Deadly 提交于 2021-02-10 19:08:52
问题 I have two separate Jena models, one containing an RDFS ontology and the other containing the statements. Right now I cannot, for example, write a query which returns all results for a particular class, since the class is not described in the RDF statements. What I want is to query the statements model by taking into account the ontology as well. How can I do this? 回答1: You can query the ontology using SPARQL language and store the result and you can query other statements using any normal

Jena: Only well-formed absolute URIrefs can be included in RDF/XML output: <A>

≡放荡痞女 提交于 2021-01-29 09:22:27
问题 I'm doing a parser from a csv file that builds an RDF. Right now it just adds as property the header of the csv and it's value. When I try to write the output as XML I get this error: Caused by: org.apache.jena.shared.BadURIException: Only well-formed absolute URIrefs can be included in RDF/XML output: <A> Code: 57/REQUIRED_COMPONENT_MISSING in SCHEME: A component that is required by the scheme is missing. But when I write it as json I get correct output. Does anyone know what I have wrong?

Strange behavior of content negotiation concerning SPARQL CONSTRUCT query

我的梦境 提交于 2021-01-29 08:28:40
问题 When issuing a SPARQL CONSTRUCT query to a specific endpoint, Apache Jena library 3.14.0 issues an error message as follows. Endpoint returned Content Type: application/sparql-results+xml which is not a valid RDF syntax The code I wrote is as follows. QueryEngineHTTP qeh = new QueryEngineHTTP(endpointUrl, rq); qeh.setAcceptHeader("application/rdf+xml"); Model m = qeh.execConstruct(); The endpoint is https://id.nlm.nih.gov/mesh/sparql . The query is as follows. CONSTRUCT {?s <http://id.nlm.nih