jena

OWL Ontology Predicate Logic with Jena

可紊 提交于 2019-12-04 16:01:36
I'm having trouble expressing the following situation in my Ontology: Suppose I have four people voting and four votes (so there is a one-to-one mapping between vote and voter). People can either vote yes or no. If I know the outcome of three people's votes, I ought to be able to deduce the fourth person's vote. So to reiterate: John, Bob, Mary, and Carol each vote. Since there are four people there are four votes. The outcome of the vote is a tie (2 yes, and 2 no). Later on the reasoner determines that Bob and John voted no. The reasoner should then be able to deduce that Mary and Carol voted

Logarithm Function in SPARQL Query

与世无争的帅哥 提交于 2019-12-04 13:51:49
I am trying to create a SPARQL query that performs the logarithm function on the returned results. I have implemented the Jena SPARQL engine in my java program, but have only been able to find these available functions : http://jena.sourceforge.net/ARQ/library-function.html Does anybody know of a way to take the logarithm (preferably the natural log) of a SPARQL return variable? Example query that works: SELECT DISTINCT ((?Transactions_Num) AS ?BusinessValue) WHERE {{?BusinessProcess relation:Transactions_Num ?Transactions_Num ;} } Example of query that I want to work (though currently does

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

人盡茶涼 提交于 2019-12-04 08:05:47
问题 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. 回答1: You could set up your own local SPARQL endpoint using Fuseki. Fuseki is part

Sparql query running forever

独自空忆成欢 提交于 2019-12-04 07:17:50
I'm struggling with the execution of a SPARQL query in Jena, with a resulting behaviour that I don't understand... I'm trying to query the Esco ontology ( https://ec.europa.eu/esco/download ), and I'm using TDB to load the ontology and create the model (sorry if the terms I use are not accurate, I'm not very experienced). My goal is to find a job position uri in the ontology that matches with the text I have previously extracted: ex: extracted term : " acuponcteur " -> label in ontology: "Acuponcteur"@fr -> uri: < http://ec.europa.eu/esco/occupation/14918 > What I call the "weird behaviour" is

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

喜欢而已 提交于 2019-12-04 06:58:04
问题 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

when i Use MySQL Database System with Jena2,i got java.lang.NoSuchMethodError

你离开我真会死。 提交于 2019-12-04 06:24:02
问题 here is my code import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.sql.SQLException; import com.hp.hpl.jena.db.DBConnection; import com.hp.hpl.jena.db.IDBConnection; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelMaker; public class myontoly { public static

Using a variable declared outside the Query string inside a SPARQL Query- Using JSP and Java Servlet

僤鯓⒐⒋嵵緔 提交于 2019-12-04 05:05:39
问题 I have 2 jsp pages. In the index page I am selecting a dropdown value and passing the selected value as a url parameter to the SearchResults page. http://localhost:8080/SearchResults.jsp?jobCat=InformationTechnology I am capturing the parameter InformationTechnology passed using below code . The query should show results for the selected value in the form. (I am selecting a job category and the results should show the candidates under selected job category) String jobCategory = request

Java - Using Jena APi - Get data from RDF file

泪湿孤枕 提交于 2019-12-04 05:01:25
问题 My question concerns the class Person with the datatype properties hasFirstName , hasLastName , hasDateOfBirth , hasGender . I'm using Java and Jena API. Here is how one person is represented in my RDF file. <rdf:Description rdf:about="http://www.fam.com/FAM#Bruno04/02/1980 "> <j.0:FAMhasGender>H</j.0:FAMhasGender> <j.0:FAMhasDateOfBirth>04/02/1980</j.0:FAMhasDateOfBirth> <j.0:FAMhasLastName>DS </j.0:FAMhasLastName> <j.0:FAMhasFirstName> Bruno</j.0:FAMhasFirstName> </rdf:Description> I want

sparql queries with round brackets throw exception

别来无恙 提交于 2019-12-04 03:20:41
问题 I am trying to extract labels from DBpedia for some persons. I am partially successful now, but I got stuck in the following problem. The following code works. public class DbPediaQueryExtractor { public static void main(String [] args) { String entity = "Aharon_Barak"; String queryString ="PREFIX dbres: <http://dbpedia.org/resource/> SELECT * WHERE {dbres:"+ entity+ "<http://www.w3.org/2000/01/rdf-schema#label> ?o FILTER (langMatches(lang(?o),\"en\"))}"; //String queryString="select * where

Why some rdf files does not contain <rdf:Description rdf:about=…>?

…衆ロ難τιáo~ 提交于 2019-12-04 02:05:40
问题 I'm using Jena to write a rdf file that describes online posts. According to the sioc ontology/namespace that I'm using there is, for instance, the following: Class: sioc:Post Property: sioc:has_creator How can I, in Jena, include the sioc:Post in the file as <sioc:Post rdf:about="http://example.com/vb/1035092"> instead of <rdf:Description rdf:about="http://example.com/vb/1035092"> and what is the best practice? 回答1: Both of the answers so far make good points: You should not pay much