jena

How to load an N-Triples model and obtain the namespaces from RDF file?(newbie)

爱⌒轻易说出口 提交于 2019-12-11 06:58:24
问题 I have an RDF/XML file like this: <rdf:RDF xmlns:go="http://www.geneontology.org/dtds/go.dtd#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <go:term rdf:about="http://www.geneontology.org/go#GO:0000001"> <go:accession>GO:0000001</go:accession> <go:name>mitochondrion inheritance</go:name> <go:synonym>mitochondrial inheritance</go:synonym> <go:definition>The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by

Spark org.apache.jena.shared.NoReaderForLangException: Reader not found: JSON-LD

冷暖自知 提交于 2019-12-11 06:46:40
问题 I am using Jena in Spark. I am facing a weird issue when I am deploying on the cluster (Does not happen on local Dev, for which i do not need to build an uber jar) When I deploy on the cluster i get the following exceptions: Caused by: org.apache.jena.shared.NoReaderForLangException: Reader not found: JSON-LD at org.apache.jena.rdf.model.impl.RDFReaderFImpl.getReader(RDFReaderFImpl.java:61) at org.apache.jena.rdf.model.impl.ModelCom.read(ModelCom.java:305) 1 - I wonder, generally speaking

Same Sparql with different result using different programs

心已入冬 提交于 2019-12-11 06:36:00
问题 I'm using TopBraid as IDE and Jena in Java. For the same SPARQL query and same file, I'm getting two different result sets. The ontology can be found here, https://dl.dropboxusercontent.com/u/108022472/ontology.owl The SPARQL is: select ?individual ?type ?label where { ?individual rdf:type ?type . ?individual rdfs:label ?label filter (?type in (wo:Kingdom)) } My Java Code: public class ExeSparql { static String prefix = "PREFIX owl: <http://www.w3.org/2002/07/owl#> " + "PREFIX xsd: <http:/

SPARQL query works in Fuseki but not in Jena TDB

本秂侑毒 提交于 2019-12-11 03:21:42
问题 I have my data organised in multiple graphs. The graph in which a triple is saved matters. The data structure is complicated but it can be simplified like this: My store contains cakes, where there's a hierarchy of different cake types, all subclasses of <cake> <http://example.com/a1> a <http://example.com/applecake> <http://example.com/a2> a <http://example.com/rainbowcake> ... Depending on how they get created by a user in a UI, they end up in a different graph. If for instance the user

How can I create customized builtins in Jena?

泄露秘密 提交于 2019-12-11 02:12:50
问题 I just wondering how I can create new custom builtins for Jena. I know that for this purpose it should be used both the class "BaseBuiltin" and the class "BuiltinRegistry" (but how ?). I have also found out a plugin for Eclipse which is called "SADL" but I am not sure if I can use if for this purpose. If I can...which method is better and why ? Could anyone of you explain me which way I should take ? Cheers! 回答1: In a follow-up to a later question of yours, I provide code demonstrating the

Federated query with secured SPARQL endpoint

南笙酒味 提交于 2019-12-11 02:04:58
问题 I'm trying to use federated queries with Jena via a Fuseki endpoint. With the SERVICE keyword in my SPARQL query, I'm connecting to a Stardog endpoint. As it's a secured URL, the endpoint is specified as follows: http://admin:admin@url. As this is not secure, Jena shows the following message: Code: 36/HAS_PASSWORD in USER: Including passwords in URIs is deprecated. According to the docs, you can specify srv:queryAuthUser and srv:queryAuthPwd for the credentials. Is there any way to do this

Jena Fuseki Server command not found

ぃ、小莉子 提交于 2019-12-11 01:12:43
问题 I am new to Jena Fuseki server. According to the link http://jena.apache.org/documentation/serving_data/index.html, after I downloaded and unzipped it on my Fedora machine,I tried to start the server using command line. Under the Fuseki directory, the command should be like this: fuseki-server --update --mem /ds , yet it gave the error: fuseki-server command not found . Is there anyone who knows what the problem is? Thanks. 回答1: It works for me. Maybe you can read through the sequence below

How to load N-TRIPLE file in apache jena?

岁酱吖の 提交于 2019-12-11 00:54:33
问题 I am quite new to RDF and Jena. I want load a .nt (N- TRIPLE) file to a model. I have tried read(inputStream, "N-TRIPLE") but did not help. It throws org.apache.jena.riot.RiotException: Element or attribute do not match QName production: QName::=(NCName':')?NCName. Can anyone point me out what is wrong? Here is the link for the N-TRiple file which I tried to load : http://dbpedia.org/data/Berlin.ntriples 回答1: read(inputStream, string) uses the string argument as the base URI, not the syntax

Export jena model to json file

核能气质少年 提交于 2019-12-11 00:32:19
问题 Hey i'm trying to make a web service and i'm using Jena distibution. At the moment i have created my model and its printing out in RDF/XML format. I want to get my data to a JSON file saved in my hard disk. How can i do that? 回答1: org.openjena.riot.out.RDFJSONWriter writes Talis-style RDF/JSON (i.e not JSON-LD). Look for a JSON-LD writer (I think there are ones that read RDF and write JSON-LD) Use SPARQL JSON Results format 回答2: Now the Jena RIOT readers/writers support also the RDF/JSON

Writing to Ontotext GraphDB using Jena

半腔热情 提交于 2019-12-11 00:00:02
问题 I am trying to use Jena to write to a local free standalone GraphDB (version 8.5.0) repository. What I have tried (1) Direct use from Jena I used this Jena 3.7.0 code snippet: String strInsert = "INSERT DATA {" + "<http://dbpedia.org/resource/Grace_Hopper> " + "<http://dbpedia.org/ontology/birthDate>" + " \"1906-12-9\"^^<http://www.w3.org/2001/XMLSchema#date> .}"; UpdateRequest updateRequest = UpdateFactory.create(strInsert); UpdateProcessor updateProcessor = UpdateExecutionFactory