FAQ Database Discussion Community


java getRuntime().exec() with redirection

java,rdf,jena,runtime.exec
I am trying to execute a terminal command in java yet I get erroneous results (even though the command is being executed). When I paste the same command to the terminal, it yields the correct output. I am guessing the problem occurs because of the redirection characters ('<','>') yet I...

How to write a SPARQL query for retrieving data from OWL file

java,sparql,jena,owl,protege
I have generated an owl file using Protege. Now I wish to access all the stationCode property values of all instances of a class RailwayStation from it. My OWL file contains the following format <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:swrlb="http://www.w3.org/2003/11/swrlb#" xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"...

Does ARQ support SPARQL 1.1 Date and Time Functions?

java,rdf,sparql,jena,arq
I have been trying to do some formatting of date/time values to make them display as string literals in the result. I am using Jena ARQ from apache-jena-2.11.0 . PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX prov: <http://www.w3.org/ns/prov#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?activity ?agent ?time ?time (YEAR(?time) as ?year )...

Federated query with secured SPARQL endpoint

sparql,jena,triplestore,federated,stardog
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:[email protected] As this is not secure, Jena shows the following message: Code: 36/HAS_PASSWORD...

Datatype dataTime insertion in ontology with SPARQL queries

java,rdf,sparql,jena,ontology
I am manually trying to insert the data in owl file with following SPARQL command: qry = "PREFIX : <http://www.example.com/tempsensor#>" + "INSERT DATA" + "{" + ":ind1 :locatedIn :Delhi ;" + ":onDate "+ "2014-10-01T00:10:10"^^xsd:dateTime +" ;" + ":measures 13 ;" + " :hasUnit Celsius ." + "}" ; UpdateAction.parseExecute(qry,ontmod); On...

Fuseki indexed (Lucene) text search returns no results

rdf,sparql,jena,owl,fuseki
I have a very large ontology RDF file (almost 4M instances) that I'm currently streaming via Fuseki v2.0.0. My assembler file looks like this: @prefix : <#> . @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 text: <http://jena.apache.org/text#> . @prefix myprefix:...

eclipse jena parsing statement

rdf,jena
I am trying to parse an RDF file into statements and display values in dropdowns as subject object and predicate. Textfields will be localNames whereas the values behind will be URI's or literals accordingly. For subjects and predicates I think I can handle this but for objects, RDFNode class doesn't...

SPARQL Group-Concat not working

rdf,sparql,jena
I've got an RDF graph element looking like this using Android & Jena: <ns0:CalendarItem rdf:about="http://my.url.com/ontologies/mash-up#CalendarItem-uh0cjvnuehhvfjpgppiggmpjac"> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-2de52a85-3107-4d82-a361-cca11afabdc8" /> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-3b0e0333-5693-43e7-bb6e-af06f7df9b12" /> <ns0:attendee...

How to query multiple tables using ARQ jena?

sparql,jena,arq
Overview I am using ARQ in order to query local RDFfiles. The query is applied on 5 files which are: a_m.nt, description.nt, labels.nt, links.nt, literals.nt Information is modeled as a set of triples: subject predicate object Algorithm First I want to select specific topics from a_m.nt file. Second I want...

Why do we need Fuseki Server?

sparql,jena,semantic-web,fuseki,tdb
I am developing an application, which is using triple store (Jena TDB). It is clealy mentioned that TDB Supports SPARQL update and Query. Also, I understood that Fuseki is SPARQL server, that supports Update and Query as well. I do not find answer do the following questions: If TDB supports...

Apache Jena save ontology file then opening it in Protégé2000

java,jena,semantic-web,ontology,protege
I opened my ontology .owl (already created in protégé2000 v5) in Protégé2000 v5. Then using java Apache Jena Framework, i save the same ontology on the same file (without any modifications done). I go back to Protégé2000 Which asks me to reload the ontology because it was modified by another...

How to define very simple own rule in fuseki step by step?

jena,fuseki,swrl,apache-jena,jena-rules
I'm asking your help to understand how to create my own property rules in fuseki. I've read the documentation of Jena and Fuseki about reasoners and rules but I don't understand how to create (step by step) simple rules. And the examples that I've found are focus on OWL reasoners....

multiple users accessing RDF file for read and write

apache,rdf,jena,rdfs
I am using an RDF file to store links (URLs) of online resources that are added by different users about various topics. I am using Jena API to read and write the RDF file, on Apache server. My concern is that multiple users would allowed at the same time to...

Java Graphs open source [closed]

graph,jena,jung,jgrapht
I want to generate a graph(nodes with many properties and weighted edges) from a CSV file data. Then, applying traversal algorithms over this graph and modifying the weights. I searched and found JUNG Graph framework and JGraphT. Can you please recommend one of them ? or suggest any free open...

how to use rdfcat from java code

java,jena
in jena api there is the class rdfcat ,it is a tool to convert data file format ,it could be used from commande line just like the example , i need to execute the tool from inside java code , i tried the code but i failed . public static...

How to filter DBpedia results in SPARQL

java,sparql,jena,dbpedia
I have a little problem... if I have this simple SPARQL query SELECT ?abstract WHERE { <http://dbpedia.org/resource/Mitsubishi> <http://dbpedia.org/ontology/abstract> ?abstract. FILTER langMatches( lang(?abstract), 'en')} I have this result: SPARQL Result and it has a non-English character... is there any idea how to remove them and retrieve just English words?...

Using an ontology to produce semantic full information from the raw data

sparql,jena,semantics,ontology,rdfs
Problem Definition: Store sensor data (temperature readings, sensor description) into rdf form using an ontoloy. Further, use SPARQL to perform queries on stored data. My Approach: I am not an expert in this domain, but I have some basic understanding and accordingly I am using this approach: 1. Create Ontology,...

Writing a Jena rule to add properties to a resource with some specific property values?

java,rdf,jena,rule
I'm trying to write a Jena rule whose antecedent matches a location where the network's bandwith is 450^^xsd:float. I've tried the following two rules. The first gives me no results. The second matches for the networks labeled Gate 23 and Gate 15, but only Gate 15 should match. [AdaptedModel: (?d2...

Query multiple models within same Dataset in TDB Jena

rdf,sparql,jena,ontology,tdb
I have an ontology (say dgo.owl) and another file containing individuals for same ontology stored in rdf format. I have stored both (ontology and instances/individual file) files in TDB under different named models (say dgo_ont and homedata). Now, I want to fire different SPARQL queries on a combination of these...

How connect Jena Fuseki Server to Netbeans like MySQL

java,mysql,sparql,jena,netbeans-8
I would like to connect Jena Fuseki server to netbeans and start to query sparql codes using java program. I did imported the jena libraries but, I'm stock on how to connect and make some queries.

Jena API Rules Test : how many and what are the methods to write rules in Jena?

java,eclipse,jena,ontology,jena-rules
I succeeded in creating, modifying, merging ontologies with Jena API and Eclipse. I succeeded also in starting the OWL reasoner and Pellet reasoner in Eclipse. Now I would like to understand how can I write a simple rule in Eclipse using Jena API and if there is one or more...

semantic web rule use “all”

jena,semantic-web,jena-rules
Assume that I have the following statements: A p B, A p C, B p C ( p is a symmetric property, i.e. B p A, C p A and C p B) A v 2, B v 1, C v 1, I want to use a rule to do...

Using Jena with Pellet; NoClassDefFoundError Exeption

java,jena,pellet
I'm trying to use Jena 2.12.1 with Pellet; I downloaded the latest Apache Jena library from their site Jena 2.12.1. First, I downloaded Pellet 2.3.1 and imported the JENA libraries. Unfortunately, org.mindswap.pellet.jena.PelletReasonerFactory couldn't be resolved, and thus, I couldn't instantiate a reasoner. Then, I downloaded multiple versions the jar file...

jena read inputstream from gzipped file

java,inputstream,jena
I have the following code to read a dataset into a jena model using inputstream however I would like my program to be able to read compressed (gzipped) files as well (using filePath). Dataset dataset = TDBFactory.createDataset(tdbPath); Model model = dataset.getDefaultModel(); InputStream str = FileManager.get().open(filePath); model.read(str,null, "N-TRIPLES"); ...

OWL-API 4.0.1 compatiable pellet reasoner?

jena,semantic-web,owl-api,pellet
I was using OWL-API version 4.0.1 together with Pellet reasoner version 2.3.6 as can be seen in the extracted from pom file maven dependency section below <dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-api</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>net.sourceforge.owlapi</groupId> <artifactId>owlapi-apibinding</artifactId> <version>4.0.1</version> </dependency> <dependency>...

Using a compact URI in Jena

java,jena,n-triples
I'm using Jena to read an ontology and it's working really well so far. Unfortunately I haven't been able to figure out how to use compact uris that I've defined in the model. I've defined the prefixes using the model's setNSPrefix(String prefix, String uri) method. When I try to retrieve...

RiotException when loading a Model using Jena 2.12.1

rdf,jena,dbpedia
I've created this simple class named RDFReader for loading a model from a URI from DBpedia: import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.util.FileManager; public class RDFReader { public static Model readFromURL(String URL){ try{ return (new FileManager()).loadModel(URL); }catch(Exception e){ e.printStackTrace(); } return null; } public static void main(String[] args) { RDFReader.readFromURL("http://dbpedia.org/resource/Pacific_Rim_(film)"); } } I've...

Virtuoso Jena provider query alias syntax

java,alias,sparql,jena,virtuoso
I have in Java the following code, that uses the Virtuoso Jena provider API. I would like to do a query using an alias. I tried putting parenthesis but nothing worked. If I put the same query in the endpoint directly it works. query = "select ?a AS ?count where...

Print dateTime without specifying datatype in Sparql output

java,rdf,sparql,jena,ontology
I am using following sparql Query in Jena to print some information: String qr = "PREFIX : <http://www.example.com/tempsensor#>\n" + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \n"+ "SELECT \n"+ "?Place ?Temperature ?Date \n"+ "WHERE\n"+ "{ ?ind :locatedIn ?Place .\n " + "?ind :measures ?Temperature .\n " + "?ind :onDate ?Date .\n " + "FILTER(regex(str(?Place),'Delhi',...

sparql to retreive the value of a min constraint

sparql,jena
How can I retreive a min constraint on a class' attribute using sparql? I have value min 1000 decimal, and I would like to get 1000 Thanks...

Persisting data in Jena TDB triple store

rdf,jena,ontology,triplestore,tdb
I am using Jena TDB to persist RDF data. Before this I searched how to persist data in TDB and I came through the question at this link. Answer provided by Ryan clearly mentions the difference between various concepts, and one of the point I got about datasets is: "A...

year() function in SPARQL

rdf,sparql,jena,semantic-web
I want to make a query in SPARQL that returns items of the year 2007. I tried this : String requete7String = "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "PREFIX dc: <http://purl.org/dc/elements/1.1/> " + "PREFIX rss: <http://purl.org/rss/1.0/> " + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "SELECT ?item " + "FROM <http://www.w3.org/2001/sw/SW-FAQ-feed.rdf> " +...

Count a specific relationship in OWL File using sparql query

sparql,jena,owl,ontology
I want to count assertions of a specific relationship in OWL file. if following is my whole Ontology:- <owl:NamedIndividual rdf:about="file:/C:/myOnt.owl#comfort"> <SynonymOf rdf:resource="file:/C:/myOnt.owl#impunity"/> <SynonymOf rdf:resource="file:/C:/myOnt.owl#sooth"/> <SynonymOf rdf:resource="file:/C:/myOnt.owl#ease"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="file:/C:/myOnt.owl#population"> <SynonymOf rdf:resource="file:/C:/myOnt.owl#habitation"/>...

Specifying class equivalence in Jena rules

jena,owl,ontology,apache-jena
Given an ontology with Class A and Class B I am stating a rule : [-> (ns:Class_A owl:equivalentClass ns:Class_B)] However the Jena generic rule reasoner is only applying the tag equivalentClass to Class A, ie. it is not stating Class B equivalentClass Class A Furthermore, I have an object A...

Replace variables within a SPARQL query in Jena

rdf,sparql,jena
I need to replace some variables(indx, placx, datx, tempx) within a SPARQL query and for the same I am using following code: ParameterizedSparqlString ps = new ParameterizedSparqlString(); ps.setCommandText("INSERT DATA" + "{" + ":indx :locatedIn :placx ;" + ":onDate datx ;" + ":measures tempx ." + "}"); ps.setIri(":","http://www.example.com/tempsensor#"); ps.setLiteral("indx",ind); ps.setLiteral("placx",plac); ps.setLiteral("datx",dat);...

Loading owl file with Jena

java,jena,owl,ontology
I load several OWL files (RDF/XML serialization) with Jena as OntModel. For some files I get an error when reading them with ontoModel.read(): Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpMessage. I have org.apache.httpcore-sources.jar in the classpath. The file which currently poses problem is: ontologydesignpatterns.org/cp/owl/timeindexedpersonrole.owl I saved it with Protege as RDF/XML,...

tdbloader2 fails with classpath error

java,rdf,jena,tdb
When I run the following command: bin/tdbloader2 --loc=/store/data/here /seed/data/serverfault-dump.nt And the response I get is: 10:52:31 -- TDB Bulk Loader Start 10:52:31 Data phase Error: Could not find or load main class com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder Which is most likely caused by a problem with my environment variables, somewhere, of something. The problem...

Sparql query not showing results

rdf,sparql,jena,owl,ontology
I have an ontology (dgo.owl) and a simple program (SparqlQuery.java) to query the same ontology. On running the query I do not get any results. After debugging for a long time I thought it would be good to put it in the community. The query script is as: OntModel ontmodque...

SPARQL query with filter for a certain date

filter,sparql,jena,fuseki
I'm new to SPARQL and I'm trying to do the following thing for my assignment: I need to pull out actors but only those that were born on a defined date. My problem is that every time I try to filter by a certain integer value, I get "Error making...

Jena RDFS reasoning not returning expected results

java,jena,rdfs,reasoning
I have the following two triples: <http://example.com/a> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/b> . <http://example.com/b> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/c> . And the following Jena code: Reasoner reasoner = RDFSRuleReasonerFactory.theInstance().create(null); reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE); reasoner.setDerivationLogging(true); Model schema =...

Maven artifact issue with stardog and sesame dependencies

maven,rdf,jena,sesame,stardog
I have a program, developed in a maven project through Eclipse, that provides an ETL service which ingests data, generates turtle format RDF using the Jena API, and loads it into a triple store which requires data sent to it using the Sesame API. As such, I need to convert...

Does Jena support enforcing OWL constraints during a SPARQL Update query?

sparql,jena,jena-rules
I'm trying to figure out if Jena (or any other SPARQL Update server) will enforce ontological constraints. For example, I want to enforce that only entities which have type x are allowed to have property y and the value of the property must have type z. I think this is...