apache-jena

Convert a Jena ResultSet to Model

牧云@^-^@ 提交于 2021-01-27 13:58:40
问题 I'm trying to convert a ResultSet to a Model in Apache Jena 3.0. Previously I used the ResultSetFormatter.toModel function, but this seems to have been removed. What's the best way currently to get a Model (for serialization to JSON-LD and RDF/XML) of the ResultSet? 回答1: RDFOutput.toModel ResultSetFormatter operations were deprecated in jena 2.13.0 with placeholders left behind and javadoc referring to RDFOutput . 来源: https://stackoverflow.com/questions/32157314/convert-a-jena-resultset-to

How to correctly import Pellet 2.3.0 in Jena 3.0.1 (Eclipse)?

余生长醉 提交于 2020-01-06 01:59:07
问题 I am trying to import Pellet 2.3.0 reasoner in Jena 3.0.1 (working in Eclipse). To do so I have read all the similar questions here (although some are outdated) and the FAQ in the Apache Jena website. Using their code I always get an error in the following line: OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC); Jena works fine and I have tested it. What I guess is that I haven't imported the right jar files for Pellet. I cloned the whole Pellet repository from

Jena for java 1.7

断了今生、忘了曾经 提交于 2019-12-25 16:25:07
问题 Is there any version compatible with java 1.7v in Jena I'm getting following error and i think it is because of incompatibility Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/jena/query/QueryFactory : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass

JavaScript for Apache Jena TripleStore

杀马特。学长 韩版系。学妹 提交于 2019-12-13 17:19:01
问题 i've build a TDB-Store with Apache Jena and now i want to use the data from my store to implement some nice visualizations. So after all it's necessary to access my TDB with JavaScript. I guess, there are two possibilities to archieve this: No. 1: Run a Fuseki Server and run sparql queries on it's endpoint (i.e. http://localhost:3030/dataset/sparql ). How can i query this endpoint with js? No. 2: Access the TDB directly from js. Is this possible? Thanks in advance, FFoDWindow 回答1: I was able

SPARQL Path between two nodes

 ̄綄美尐妖づ 提交于 2019-12-12 17:43:15
问题 Given a graph: @prefix da: <http://example.com/data/> . @prefix on: <http://example.com/on/> . da:Shenaz on:husband da:Javed . da:Rita on:friend da:Noor ; on:sister da:Tom . da:Noor on:sister da:Shenaz . da:Javed on:child da:Jaabir . da:Tom on:sister da:James . da:Jaabir on:grandFather da:Rafick . There is a path between da:Noor and da:James which is da:Noor ^on:friend/on:sister/on:sister da:James . but the following query is returning false PREFIX da: <http://example.com/data/> PREFIX on:

405 HTTP method PUT is not supported by this URL

拜拜、爱过 提交于 2019-12-12 03:46:35
问题 I started Fuseki server using this configuration: @prefix : <#> . @prefix fuseki: <http://jena.apache.org/fuseki#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix sdb: <http://jena.hpl.hp.com/2007/sdb#> . [] rdf:type fuseki:Server ; fuseki:services ( <#memory> <#tdb> #<#mysql> ) . # Custom code. [] ja

How to unload data from Jena Fuseki server

安稳与你 提交于 2019-12-12 02:44:25
问题 I am loading data to a named graph in fuseki server using the following command . How to remove the particular graph from jena fuseki server.Is there any simple commands similarly. '/home/user/jena-fuseki-1.1.1/./s-put http://192.168.1.2:3030/ds/data http://graph/graph1 /home/user/files/uniquename.ttl' How can i unload named graph from jena fuseki server. 回答1: Assuming you want to do this in a similar manner to adding a graph s-delete http://192.168.1.2:3030/ds/data http://graph/graph1 SPARQL

Apache Fuseki: invoke str function

老子叫甜甜 提交于 2019-12-11 04:39:38
问题 I would run this query: SELECT DISTINCT ?id str(?name) but Fuseki give me this error: This line is invalid.Expected ( VAR1... I would need a string value of ?name . 回答1: I suppose you are talking about something like this. This message is a warning produced by Fuseki component called YASGUI (or rather YASQE). You have two options: Use more conformant syntax, i. e. SELECT DISTINCT ?id (str(?name) AS ?str_name) etc. Ignore this warning and run your query, Jena ARQ should accept it and return a

Delete blank node from ontology through SPARQL UPDATE

北战南征 提交于 2019-12-11 01:48:35
问题 I am storing some data in my ontology model made in protege with help of a SPARQL UPDATE 'insert' operation. Below is the update query. PREFIX test: <http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#> insert { [] test:Kpi_Variable ?s ; test:hasValue_ROB4 ?p ; test:hasTime ?now . } where { values (?s ?p) { (test:Actual_Production_Time 33) } bind (now() as ?now) } It stores in the rdf graph in the following way: [ test:Kpi_Variable test:Actual_Production_Time ; test

parameterized SPARQL Query

浪尽此生 提交于 2019-12-10 12:26:52
问题 I want to code a parameterized SPARQL Query in Java Jena where one of the triple in query be injected so in the code below I need to inject value as a string the pass to the class However, the SPARQL query is correct so when I replace "value" with the class name I got the right result I tried two code non of them worked No result or run time error the first code: package ontology; import org.apache.jena.iri.impl.Main; import com.hp.hpl.jena.query.ParameterizedSparqlString; import com.hp.hpl