Questions tagged [apache-jena]

Apache Jena is a free and open source Java framework for building Semantic Web and Linked Data applications.

This is a synonym for the Jena tag.

Apache Jena Homepage

Links

185 questions
1
vote
1 answer

Apache Fuseki: invoke str function

I would run this query: SELECT DISTINCT ?id str(?name) but Fuseki give me this error: This line is invalid.Expected ( VAR1... I would need a string value of ?name.
Kebby
  • 15
  • 4
1
vote
1 answer

apache jena rename resource doesn't check prefix

I'm trying to change the URI of a resource in a Model. I'm using ResourceUtils.renameResource it works, but when i save the model in a file, the new URI is extended (has the form instead of prefix:resource) even though…
Giuseppedes
  • 129
  • 9
1
vote
1 answer

how to get datatypeProperty and objectProperty of an instance(Individual) in jena

For example, i have a jena OntModel, with many classes, individuals and properties. I want to konw how many datatypeProperty and objectProperty are set for an specific individual. I have code below, given an Individual, ind.listProperties() will…
zhiqiu
  • 405
  • 4
  • 11
1
vote
1 answer

Can anyone tell me whats wrong with this SPARQL QUERY?

I am using Eclipse and Jena. I have already made some queries that worked, and I cant find the mistake in this one. This is my code: // Create a SPARQL query from the given string. String queryString = //"PREFIX rdfs:…
Isidora Bojovic
  • 101
  • 2
  • 5
1
vote
1 answer

Convert Java Object to RDF XML

I want to convert Java object to RDF XML. I am using Jena API. I don't want to call any REST call. On REST method, we can write: @Produces(OslcMediaType.APPLICATION_RDF_XML) So it sends the response in RDF XML format. I can't use this, because I…
rathod151
  • 97
  • 8
1
vote
1 answer

Cannot run particular SPARQL query using Apache Jena

I'm trying to run the following query using Apache Jena PREFIX rdfs: PREFIX vrank: PREFIX dbp-ont: PREFIX…
AndyFaizan
  • 1,833
  • 21
  • 30
1
vote
1 answer

SPARQL over HTTP

I am trying to query my dataset via HTTP 'get' method. I am using POSTMAN to use the HTTP method. Here is my complete url //localhost:3030/DS-1/sparql?query=PREFIX test:http://www.semanticweb.org/muhammad/ontologies/2017/2/untitled-ontology-14#…
Usman Khan
  • 147
  • 15
1
vote
1 answer

Retrieval of synonyms of an instance from whole ontology

Individual ind = model.createIndividual("http://www.semanticweb.org/ontologies/Word#Human", isSynonymOf); System.out.println( "Synonyms of given instance are:" ); StmtIterator it =ind.listProperties(isSynonymOf); while( it.hasNext() )…
ALee
  • 53
  • 1
  • 8
1
vote
1 answer

SPARQL Query against default graph of Jena dataset

In thingweb-repository in file ThingDescriptionCollectionHandler.java on line 173: tdb = dataset.getDefaultModel(); tdb.createResource(resourceUri.toString()).addProperty(DC.source, data); Question: I am trying to write a SPARQL query to run…
SHAHS
  • 462
  • 1
  • 5
  • 13
1
vote
1 answer

Can I use Apache Jena and persist the ontology using Apache Solr

We have a cloud base Java application that uses Oracle DB and Apache Solr for document indexing/searching. I need to implement an ontology and I intend to use Apache Jena. It's an uncharted territory for me. According to the docs, seems that using…
Jimo
  • 143
  • 2
  • 14
1
vote
1 answer

Why this exception occur com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: In Using Apache Jena Reasoner?

Here is my code: public class FunctionalityCheckTest1 { InfModel infModel; Model model = ModelFactory.createDefaultModel(); String NS = "http://myweb.com/vocab#"; @Test public void playingWithJenaReasoner() { …
Badman
  • 407
  • 5
  • 17
1
vote
1 answer

jar file can not load ontology while java code in eclipse load it

I have a java code that load an ontology and then use it. the code work correctly when I run program using eclipse. but when I convert project to runnable jar file it can not load the ontology.it does not produce any error. It seems it tacks many…
Mosafer Koochooloo
  • 189
  • 1
  • 1
  • 8
1
vote
3 answers

Fail to load turtle files using jena assembler file

I define an assembler file with name dataset2.ttl. The content of this file is: @prefix tdb: . @prefix rdf: . @prefix rdfs: …
WuZhu
  • 75
  • 6
1
vote
1 answer

How to add NameSpace/PrefixMap in Apache Jena Model?

I don't know why after setting setNsPrefix of Model it doesn't work according to my expectation.This is my Java Code public class TestClass { public static void main(String[] args){ Model model = ModelFactory.createDefaultModel(); …
Badman
  • 407
  • 5
  • 17
1
vote
2 answers

ConversionException to an OntClass?

I'm having trouble with OntClass.listSubClasses. I'm using this method in a loop, which works fine until a given point: for(Iterator i = class.listSubClasses() ; i.hasNext() ;) { System.out.println(((OntClass) i.next()).getLocalName()); } Then,…
Richard-Degenne
  • 2,892
  • 2
  • 26
  • 43