Questions tagged [jena]

Apache Jena is an open-source Java library for processing "Resource-Description-Framework" (RDF) data in semantic web and linked-data applications. This includes command-line tools for RDF-based applications.

Apache Jena is an open-source Java library for processing Resource-Description-Framework (RDF) data in semantic web and linked-data applications. This includes command-line tools for RDF-based applications.

Links

Summary

Jena is an open-source Java library for processing RDF data. Originally developed by HP Labs, the project was accepted by Apache as an incubator project in 2010, and graduated from the incubator to become Apache Jena in April 2012. RDF is a standard notation for representing information about things in the world, and especially resources on the World Wide Web. RDF was developed by the W3C as part of its semantic web activity. Related W3C standards include the query language SPARQL and ontology language OWL.

RDF builds representations from a simple basic propositional structure, in which some object stands in some named relation to some subject. For example,

StackOverflow is-about programming-questions

Here, StackOverflow is the subject, the category programming questions is the object, and the named predicate denoting the relationship between subject and object is is about. In order to work effectively with resources on the WWW, names of things, including names of predicates, are URI's, so we might actually write the previous example using http://www.stackoverflow.com as the subject, the Dublin Core property has subject as the predicate and the DBPedia resource for computer programming as the object. Thus:

<http://www.stackoverflow.com>
   <http://purl.org/dc/terms/subject>
       <http://dbpedia.org/resource/Category:Computer_programming>

This basic building block of RDF representations has three elements, subject, predicate and object, and so is often referred to as a triple, and a data structure for storing triples is typically called a triplestore. Since the object of one triple can be the subject of another, a graph structure can be built to represent quite complex descriptions.

Jena includes parsers for all of the main encoding syntaxes for RDF triples: RDF/XML, Turtle, N-Triples and RDFa, and generators for the first three (RDFa is embedded in an HTML document, so cannot be generated simply by serializing an RDF graph). Jena has a complete implementation of the SPARQL query language for RDF, and tracks recent decisions by the relevant W3C working groups. Jena also includes a convenience API and rule-based reasoner for handling OWL ontologies, though is currently restricted to version 1 of OWL. The rule engine can also be used with custom rule-sets developed by the user. Jena's storage strategies for RDF graphs range from simple in-memory data structures to custom persistent stores using B-trees or building on top of existing relational engines. Jena also includes a range of command-line tools to assist developers with a variety of standard tasks, from checking RDF documents to initializing persistent stores.

Questions tagged with the Jena tag can be about any aspect of programming semantic web applications using the Jena library. General questions about the semantic web, or about linked data applications, but not involving Jena per se should not use this tag.

2388 questions
9
votes
2 answers

Calculate length of path between nodes?

How can I retrieve the length of a path between two nodes? For instance, given an organizational hierarchy, how can I determine how far separated are a parent and an descendant organization? Consider the following scenarios: OrgA…
Chantz
  • 5,883
  • 10
  • 56
  • 79
9
votes
1 answer

Using Jena to create a SPARQL query on DBpedia

Im trying to create a SPARQL 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:…
Marcom
  • 4,621
  • 8
  • 54
  • 78
9
votes
1 answer

Load DBpedia locally using Jena TDB?

I need to perform a query against DBpedia: SELECT DISTINCT ?poi ?lat ?long ?photos ?template ?type ?label WHERE { ?poi ?label . ?poi ?lat . ?poi…
George Papatheodorou
  • 1,539
  • 19
  • 23
9
votes
1 answer

Querying DBpedia with SPARQL and Jena

I cannot understand how can I query DBpedia 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")); //…
Eugeniu Torica
  • 7,484
  • 12
  • 47
  • 62
8
votes
1 answer

SPARQL: How to get an insance of an ontology, if depth of the class hierarchy is unknown?

I have a question about SPARQL. I have an ontology of animals: Animals (is a superclass with object property ) ------ Mammals (subclass of Animals) ------------- Dog (subclass of Mammals) ---------------- dog1 (a instance with property…
ERG
  • 141
  • 2
  • 9
8
votes
5 answers

dotNetRDF VS Jena.NEt VS others with Dotnet ?

what is the most common tool used for Reading & Writing RDF and Querying with Sparql with different end points . so far i've found Jena (jena.net) : it's developed for Java but some people managed to convert it to Assemblies DotnetRDF i…
Hady Elsahar
  • 2,121
  • 4
  • 29
  • 47
8
votes
2 answers

What are the Best Practices in developing semantic application using Jena & RDF

Semantic Web: Best Practices I am new to Semantic Web, in my application, I'm using Protege,RDF,SPARQL,Jena,Virtuaso. My concern is, in popular Java Frameworks (like Hibernate), we have POJO layer, in this Semantic Web application can I have the…
pc_
  • 131
  • 5
8
votes
0 answers

Named Graphs v Default Graph behaviour in Apache Jena Fuseki

We are running Apache Jena Fuseki. If we upload graphA and graphB SELECT (COUNT(*) as ?count) FROM FROM WHERE { ?s ?p ?o . } gives 100 If we upload triples in A and B into Default SELECT (COUNT(*) as ?count) WHERE { ?s ?p ?o…
Ribeye
  • 2,137
  • 3
  • 18
  • 25
8
votes
2 answers

Jena read from turtle fails

I have just imported jena libraries to eclipse to work on rdf-s and it is my first try, but I cannot read a turtle (.ttl) file. I tried it in the following way: import java.io.*; import java.util.*; import com.hp.hpl.jena.rdf.model.*; public class…
kemenesendre
  • 165
  • 1
  • 1
  • 11
8
votes
2 answers

How to get all of the subjects of a Jena Query?

Suppose I have some jena query object : String query = "SELECT * WHERE{ ?s ?o ...etc. }"; Query q = QueryFactory.create(query, Syntax.syntaxARQ); What would be the best way to get all of the subjects of the triples in the query?…
Nick Bartlett
  • 4,865
  • 2
  • 24
  • 37
8
votes
2 answers

Sparql Query Results without Namespace

I want to get results from sparql query and the results contain no namespace. ex: there is result in triple format like: "http://www.xyz.com#Raxit" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://www.xyz.com#Name" So i want to get only…
Raxit
  • 242
  • 3
  • 11
7
votes
1 answer

Jena: how to query data from model?

Is it possible to query data from a Model without writing sqarql-queries? Adding properties to resources or resources to models can be done easily, but I haven't found out yet, if there is a more efficient way to query data from a Model than using…
Pedro
  • 4,100
  • 10
  • 58
  • 96
7
votes
2 answers

Parameterized SPARQL query with JENA

I'm trying to build a small semantic web application using Jena framework, JSP and JAVA. I have a remote SPARQL endpoint and I've already written a simple query which works fine but now I need to use some parameters. Here is my code so far: final…
sandra
  • 191
  • 1
  • 2
  • 4
7
votes
4 answers

Is it possible to find out whether two instances are of the same RDF class, programmatically?

Is it possible to find out whether two instances are of the same class, programmatically (Using api such as JENA)
PCoder
  • 2,165
  • 3
  • 23
  • 32
7
votes
1 answer

Sparql- how to get number of triples?

I'm doing a small exercise on sparql. Using Dbpedia Endpoint, I need to count number of triples. This is my query // Get the number of triples // SELECT (COUNT(*) as ?Triples) WHERE { ?s ?p…
Aziz Mumtaz
  • 95
  • 1
  • 6