jena

SPARQL parse error with Jena, but DBpedia accepts the query

好久不见. 提交于 2019-12-02 22:20:39
问题 I'm using Jena to launch a SPARQL query. I have this code, which produces an error. I don't understand the reason for this error, since putting the query into the DBpedia SPARQL endpoint works! I think that I wrote the query string correctly. What's the error? Code String sparqlQueryString= "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "+ "select ?sub ?super (count(?mid) as ?length) where {"+ "values ?sub { <http://dbpedia.org/ontology/Writer> }" + "?sub rdfs:subClassOf* ?mid ."+ "

Where do I test my queries for my RDF written in SPARQL

Deadly 提交于 2019-12-02 20:32:32
I am a beginner with Semantic Web technologies, My question might be a very basic one but I am really stuck figuring it out. I have a RDF file I created from an XML and have validated it using w3.org RDF VALIDATOR. My question is how can I run queries on my RDF document using SPARQL. The online resource http://demo.openlinksw.com/sparql does not work and I have no Idea what or how to find information about this. Thomas You could set up your own local SPARQL endpoint using Fuseki . Fuseki is part of the Apache Jena Project but can be downloaded as a standalone application (at the link above).

Conversion from OWLOntology to Jena Model in Java

两盒软妹~` 提交于 2019-12-02 17:59:38
问题 I need to convert data from OWLOntology object(part of OWL api) to Model object(part of Jena Api). My Java program should be able to load owl file and send its content to fuseki server. According to what I read, working with fuseki server via Java program is possible only with Jena Api, that's why I use it. So I found some example of sending ontologies to fuseki server using Jena api, and modified it to this function : private static void sendOntologyToFuseki(DatasetAccessor accessor,

Writing SPARQL queries with Jena to query for IRIs like: http://pt.dbpedia.org/

我与影子孤独终老i 提交于 2019-12-02 17:59:24
问题 I'm using Jena to write a SPARQL query to get the rdfs:label property from a URI received as a method parameter. That method only receives URIs like: http://pt.dbpedia.org/.. It should return me the rdfs:label , but it doesn't return me anything. I checked and it doesn't enter the while block supposed to iterate the results. I even made a test with the URI: <http://pt.dbpedia.org/resource/Brasil> , but it didn't work. What may be the problem? public String getLabel(String uri, String label) {

Generating TDB Dataset from archive containing N-TRIPLES files

人走茶凉 提交于 2019-12-02 16:28:24
问题 Apologies, in advance, for a possible duplicate. I have an archive containing 117,426 files (each in the N-TRIPLES format) that I wish to load into the default graph of a TDB dataset. Due to the large number of files, I need to be able to perform this import without manually selecting individual files for upload. I am in Bash, with Jena and Fuseki distributions at my disposal. If possible, I want to avoid the worst-case scenario of just writing a java application to do this. If I have to

Adding blank nodes to a Jena model

ε祈祈猫儿з 提交于 2019-12-02 14:56:52
问题 I'm trying to populate a Jena ontology model with an existing set of triples, some of which contain blank nodes. I want to maintain these blank nodes inside this new model faithfully but I can't work out a way of adding them into a Jena model. I have been using: Statement s = ResourceFactory.createStatement(subject, predicate, object); To add new statements to the model: private OntModel model = ModelFactory.createOntologyModel(); model.add(s); but this only allows for certain types as

how to get specific tag related information from RDF file using java

社会主义新天地 提交于 2019-12-02 14:26:35
问题 I am using Jena to read an RDF file, but I want to get the information just specific statements. Below is my sample code to read sample.rdf . sample.rdf : <rdf:Description rdf:about="http://d.opencalais.com/dochash-1/6ee25504-ff98-34e4-af60-dde69f5ddf73/Instance/143"> <c:length>4</c:length> <c:offset>6588</c:offset> <c:suffix> network, specific mechanisms for implementing</c:suffix> <c:exact>VoIP</c:exact> <c:prefix>applications. Topics include imple-menting a </c:prefix> <c:detection>

Triple Stores vs Relational Databases [closed]

五迷三道 提交于 2019-12-02 14:14:44
I was wondering what are the advantages of using Triple Stores over a relational database? The viewpoint of the CTO of a company that extensively uses RDF Triplestores commercially: Schema flexibility - it's possible to do the equivalent of a schema change to an RDF store live, and without any downtime, or redesign - it's not a free lunch, you need to be careful with how your software works, but it's a pretty easy thing to do. More modern - RDF stores are typically queried over HTTP it's very easy to fit them into Service Architectures without hacky bridging solutions, or performance penalties

Matching strings with at least one word in common

倾然丶 夕夏残阳落幕 提交于 2019-12-02 13:45:51
问题 I'm making a query to get the URIs of documents, that have a specific title. My query is: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?document WHERE { ?document dc:title ?title. FILTER (?title = "…" ). } where "…" is actually the value of this.getTitle() , since the query string is generated by: String queryString = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "PREFIX dc: <http://purl.org/dc/elements/1.1/>

HttpException error when I call SPARQL query (on DBPedia) in Java Code

安稳与你 提交于 2019-12-02 13:21:38
I have a problem with SPARQL endpoint using Java Code. In particular, I have this Java Class: public class example { public static void main(String[] args) { String value = "http://dbpedia.org/resource/Fred_Guy"; example exam = example(); QueryExecution qe = exam.query(value); ResultSet results = ResultSetFactory.copyResults( qe.execSelect() ); } public QueryExecution query(String stringa){ ParameterizedSparqlString qs = new ParameterizedSparqlString( "" + "prefix dbpediaont: <http://dbpedia.org/ontology/>\n" + "prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "\n" + "select