jena

RDF / Jena: program logic changed by println??

I'm getting a strange effect in Jena 2.5.5 (on linux) where I am playing around with the inference API. The following code is a stripped down version. I am creating an initially empty Model and a generic rule reasoner. I add a reflexivity rule for a certain statement. I attach the reasoner to the model to get an InfModel. Then I create ...

Serializing JENA OntModel Changes

I need to keep a couple of [Jena] Models (OntModels, specifically) synchronized across a socket, and I'd like to do this one change at a time (for various reasons -- one being that each Statement added or removed from the OntModels is also adapting a JESS rule base.). I am able to listen to the add/remove events on the OntModels and the...

Read Jena OntModel with Dependencies

I'm new to the concept of ontology and Jena, so I'm not sure I'm phrasing this correctly.. I need to read a series of connected owl files (by namespace dependencies?) into an in memory Jena model (OntModel?) so inference can be run. How do I do this? Does the order of the files matter? Do I need to call a specific method to "run the ...

Toggle Jena Reasoner

I have a Jena ontology model (OntModel) which I'm modifying programatically. This model was initially created using the default ModelFactory method to create an Ontology model (with no parameters). The problem was, as the program ran and the model was changed, the default Jena Reasoner would run (and run and run and run). The process ...

add xml:base to xml file in java

I want to add an xml:base declaration to an xml file in java. I currently have the xml output in an OutputStream that was generated by some third party code. The file starts out like this: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns="http://www.mycompany...

Synchronizing Jena OntModels with bnodes

This question relates to rcreswick's question on Serializing Jena OntModel Changes. I have Jena models on two (or more) machines that need to remain synchronized over sockets. The main issue that I need to address is that the models may contain anonymous nodes (bnodes), which can originate in any of the models. Question: Am I on the r...

Generating Jena Bnode IDs

Is there a way to override Jena's default method for generating anonymous node IDs? Ideally, I'd like to pass Jena a functor that would generate IDs so that I can make them globally unique (rather than just unique to the machine). The functor should be used whenever an AnonId is constructed. public interface IdGenerator { public St...

Is there a way to read a Hibernate Session as RDF triples?

I need to query my local Hibernate managed datastore for persisted objects based on criteria where the relevant data for the WHERE clause is in the Linked Open Data cloud. Is there a way to read a Hibernate Session as RDF? If so, I can at least use the combined Dataset to decide what objects to retrieve from Hibernate. Preferably the s...

Retrieving all the ancestors of a rdf:Class

Hi all, Imagine the following Taxonomy (acyclic & directed graph): <my:Eukaryota> <rdfs:subClassOf> <my:Organism>. <my:Mammal> <rdfs:subClassOf> <my:Eukaryota>. <my:Primate> <rdfs:subClassOf> <my:Mammal>. <my:HomoSapiens> <rdfs:subClassOf> <my:Primate>. <my:Bacteria> <rdfs:subClassOf> <my:Organism>. <my:Escherichia> <rdfs:subClassOf> <m...

how to get the base namespace from an OWL ontology file in java with jena

Hi, I'm new to Jena API's , I'm trying to figure out a way to get the base Namespace from a OWL ontology file, without using DOM or similar but just using the standard Jena's API. Is there such a way?? in an OWL file like how do I get the base namespace "http://www.owl-ontologies.com/Ontology1254827934.owl" a runtime?? Many many than...

Using the Jena RDF library, how do I return the property of a URI resource?

I have a Jena URI Resource (Resource reference to an object where isURIResource() returns true). An example Resource URI is this: http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5 If you open that in a web browser, you'll probably be given the HTML representation of the data: http://d.opencalais....

Quering dbpedia with SPARQL and Jena.

Hi Guys. I cannot understand how can I query dbpedia.org using Jena. In the tutorials like here(Listing 4) model is initialized as follows: // Open the bloggers RDF graph from the filesystem InputStream in = new FileInputStream(new File("bloggers.rdf")); // Create an empty in-memory model and populate it from the graph Model model = M...

Which knowledge base/rule-based inference engine to choose for real time Runway incursion prevention system

Hello, we are designing a project that would listen to dialog between airport controllers and pilots to prevent runway incursions (eg. one airplane is taking off while other is crossing the runway). Our professor wants us to use Jena for knowledge base (or anything else but it should be some sort of rule-based engine). Inference is not t...

Visualize a Jena ontology model in Java

Hi, I would like to visualize an Ontology model created through Jena in Java. Is there an API which can help me out in this task ? Or at least a tutorial on the matter? Thanks in advance. ...

Using Jena to create a sparql query on dbpedia

Im trying to create a Sqarql query using Jena to query dbpedia. The query is working when I use it with standalone tools (Twinkle) but when I plug it in this java code it returns an empty set. String sparqlQueryString1= "PREFIX dbont: <http://dbpedia.org/ontology/&gt; "+ "PREFIX dbp: <http://dbpedia.org/property/&gt;"+ ...

Using FileOutputStreams and Jena Models in Java Servlets within an Eclipse Web Project

Hi, I have recently created a web project in Java using eclipse. I have a servlet which includes a timer task. This timer tasks calls the "writeList" method of an XML Writing class that I have created. This all works fine, and I have verified that it runs every minute using System.out. When I run my XML Writing class from within eclips...

SPARQL Jenna Query Help

Hi Everyone Just a small thing tonight; I was wondering how I could modify this query to show only bands with the name "kinks", I tried tagging = #kinks after dc:Band but got no results. Query SPARQL_QUERY = QueryFactory.create("" + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;" + "PREF...

query in sparql for protege

Hi, I want write query that allow to display all comment of all class in protege and other query to display specific comment please ,Iwante the answer quickly as soon as possible . ...

What are the Jena methods used to access an ontology?

Hello I'm new to ontologies, my assignment is to create an ontology using Protege V4.0.2, (which I've done) and to create a website over that ontology(which I'm working on), i just need the basics on how to search the ontology using the Jena library I dont have any specifics because i haven't yet started. but i'm in a time crunch, and i ...

Jena result in UTF-8 format

How can I get in Jena (Java language) result in UTF-8 format? My code: Query query= QueryFactory.create(queryString); QueryExecution qexec= QueryExecutionFactory.sparqlService("http://lod.openlinksw.com/sparql", queryString); ResultSet results = qexec.execSelect(); List<QuerySolution> list = ResultSetFormatter.toList(results); System....