jena

How could I store multiple ontologies in TDB

人走茶凉 提交于 2019-12-02 01:29:47
I am working on a project which need to save multiple ontologies in one TDB. I tried to do it in my own way, but it didn't work. Help me please..If you know how to use TDB , could you post the code applied to my code? String directory = "./111"; Dataset dataset = TDBFactory.createDataset(directory); Model tdb = dataset.getNamedModel("test1"); String source = "file:///e:/Course.rdf"; System.out.println(tdb.toString()); tdb.commit(); tdb.close(); String source2 = "file:///e:/lyx/resouces/Course1.rdf"; Model tdb2 = dataset.getNamedModel("test2");//see error1 information FileManager.get()

writing Jena built-ins

久未见 提交于 2019-12-02 01:01:10
I'm trying to write a Jena built-in to return a value from an algorithm I have been given and then do a comparison against that value, e.g., String rule = "[exRule: (?d rdf:type ex:abc)" + "<-" + // ...extract ?a, ?b to use as inputs to the rule "greaterThan(myBuiltIn(?a, ?b), 1)" + // Is return value greater than 1 "]"; So, first the Jena documentation says that the easiest way to experiment with this is to look at the examples in the builtins directory, however I don't seem to have this in my installation, I'm using Jena 2.6.4 on Windows 7. Where can I find this? Do I need to download it

HTTP Status 500 - Servlet execution threw an exception

匆匆过客 提交于 2019-12-01 23:06:22
问题 I am getting this error while calling a java class in servlet. Here is the error. type Exception report message Servlet execution threw an exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NoClassDefFoundError: com/hp/hpl/jena/query/QueryFactory com.complexible

How to list and count the different types of node and edge entities in the graph data using SPARQL query?

[亡魂溺海] 提交于 2019-12-01 23:00:22
I'm looking to provide some summary stats for a data set and I want to list the different types of edge entities and node(vertex) entities in the graph. For example: -> In Twitter Social network graph of users and following relationship (Homogeneous graph), there is only one type of vertex entity (user), but in heterogeneous graphs such as ConceptNet data, it will have multiple values. -> The edge entities can be computed by just counting the different number of predicates I believe using the query : SELECT DISTINCT (?p AS ?DistinctEdges) { ?s ?p ?o } But I am not sure how to do so for

converting resultset to RDF/XML in Jena

时光怂恿深爱的人放手 提交于 2019-12-01 22:57:32
问题 I'm trying to convert a resultset in XML/RDF format but with this code: ResultSet result = rmParliament.selectQuery(select); System.out.println(ResultSetFormatter.asText(result)); ResultSetFormatter.outputAsRDF(System.out, "RDF/XML", result); The second line of the code is to verify the correct behaviour of the query (it works!), but I get in the console the following output: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns

HTTP Status 500 - Servlet execution threw an exception

╄→гoц情女王★ 提交于 2019-12-01 21:48:41
I am getting this error while calling a java class in servlet. Here is the error. type Exception report message Servlet execution threw an exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NoClassDefFoundError: com/hp/hpl/jena/query/QueryFactory com.complexible.common.csv.MuseumData.gts(MuseumData.java:109) com.complexible.common.csv.MuseumData.ass(MuseumData.java

JSON-LD blank node to nested object in Apache Jena

六眼飞鱼酱① 提交于 2019-12-01 20:49:39
I have the following example Turtle document: @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix example: <http://example.com/vocabulary/> . @prefix dcat: <http://www.w3.org/ns/dcat#> . <http://example.com/datasets/1> a dcat:Distribution ; example:props [ example:prop1 "hello" ; example:prop2 "1" ] ; dct:description "test data" . I converted it into JSON-LD with the Apache Jena (RDFDataMgr with JSONLD_COMPACT_PRETTY) to JSON-LD: { "@context": { "dct": "http://purl.org/dc/terms/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",

converting resultset to RDF/XML in Jena

浪尽此生 提交于 2019-12-01 20:28:28
I'm trying to convert a resultset in XML/RDF format but with this code: ResultSet result = rmParliament.selectQuery(select); System.out.println(ResultSetFormatter.asText(result)); ResultSetFormatter.outputAsRDF(System.out, "RDF/XML", result); The second line of the code is to verify the correct behaviour of the query (it works!), but I get in the console the following output: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rs="http://www.w3.org/2001/sw/DataAccess/tests/result-set#" > <rdf:Description rdf:nodeID="A0"> <rs:size

tbloader vs SPARQL INSERT - Why different behaviour with named graphs?

时光毁灭记忆、已成空白 提交于 2019-12-01 18:49:53
There is a strange behaviour in the connection of the commandline tools of ARQ, TDB and Named Graphs. If importing data via tdbloader in a named graph it can not be queried via GRAPH clause in a SPARQL SELECT query. However, this query is possible when inserting the data in the same graph with SPARQL INSERT. I have following assembler description file tdb.ttl : @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . [] ja

sparql queries with round brackets throw exception

℡╲_俬逩灬. 提交于 2019-12-01 17:38:17
I am trying to extract labels from DBpedia for some persons. I am partially successful now, but I got stuck in the following problem. The following code works. public class DbPediaQueryExtractor { public static void main(String [] args) { String entity = "Aharon_Barak"; String queryString ="PREFIX dbres: <http://dbpedia.org/resource/> SELECT * WHERE {dbres:"+ entity+ "<http://www.w3.org/2000/01/rdf-schema#label> ?o FILTER (langMatches(lang(?o),\"en\"))}"; //String queryString="select * where { ?instance <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>; <http