jena

Jena fileManager cannot find file?

耗尽温柔 提交于 2019-12-13 02:37:39
问题 I use Jena FileManager to load a model from a local rdf file. The java code run correctly in Eclipse. But when I call this java class from matlab. The partial source code is the following: public static Set<String> getSubjectsRelatedToProperty(String filePath) throws IllegalArgumentException, URISyntaxException { // read the resourceMap FileManager fm = FileManager.get(); model = fm.loadModel(filePath); return result_set; } The error I received is attached below. -------------- Error Details:

SPARQL filter language if possible in multiple value context

☆樱花仙子☆ 提交于 2019-12-13 02:11:23
问题 Consider the following extract from the GeoNames database : @prefix gn: <http://www.geonames.org/ontology#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <http://sws.geonames.org/690791/> a gn:Feature ; gn:featureClass gn:A ; gn:featureCode gn:A.PCLI ; gn:alternateName "Україна"@uk , "ܐܘܟܪܢܝܐ"@arc , "Ուկրաինա"@hy , "ウクライナ"@ja , "Úkraína"@is; gn:name "Ukraine" ; gn:officialName "Ucraína"@gl , "Ukraine"@fr , "U-crai-na (Ukraine)"@vi , "ཡུ་ཀརེན།"@bo. So, I'm trying to get the name in

populate an existing ontology from a csv file using Jena

≡放荡痞女 提交于 2019-12-13 02:06:34
问题 How to read an ontology (owl file) using jena and populate this ontology (ontModel) from a CSV file then write the populated OntModel into OWL file 回答1: There are three parts to your question: reading an OWL file into a Jena Model converting a CSV file into RDF writing the contents of a Jena Model out to a file The first and third of these are easy with Jena (see Model.read() and Model.write() methods, and the FileManager for some additional convenience support for reading from different

Output format in Jena Fuseki server

浪子不回头ぞ 提交于 2019-12-13 01:02:37
问题 Given this command: prefix dm: <http://one.example/> SELECT ?pID WHERE { ?pID dm:hasDName "xxxvvvII" . } The arq engine outputs the following: ------------------- | pID | =================== | dm:C002172 | ------------------- The fuseki server outputs the following: { "head": { "vars": [ "pID" ] } , "results": { "bindings": [ { "pID": { "type": "uri" , "value": "http://one.example/C002172" } } ] } } First question: how can I make the Fuseki server output the result in a more readable way with

strange namespaces declarations

半城伤御伤魂 提交于 2019-12-13 00:11:51
问题 I'm using jena 2.6.4, and I notice a strange behavior with namespaces. I'm using the following code: public static void main(String[] args) { String myUri = "http://www.example.com/1.0/myUri#"; OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); model.setNsPrefix("myuri", myUri); OntClass c616 = model.createClass(myUri + "616"); OntClass c123 = model.createClass(myUri + "123"); Individual a = c616.createIndividual(myUri + "a"); a.addOntClass(c123); model.write(System.out)

JENA: Endpoint returned Content-Type: text/html

。_饼干妹妹 提交于 2019-12-12 18:52:31
问题 When I try to send a sparql query to some endpoint, for example: QueryExecution qe = QueryExecutionFactory.sparqlService("http://data.open.ac.uk/sparql", getStringForQuery()); ResultSet results = qe.execSelect(); I get Exception in thread "main" org.apache.jena.query.QueryException: Endpoint returned Content-Type: text/html which is not currently supported for SELECT queries at org.apache.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:372) at org.apache.jena

Loading owl file with Jena

寵の児 提交于 2019-12-12 14:19:04
问题 I load several OWL files (RDF/XML serialization) with Jena as OntModel . For some files I get an error when reading them with ontoModel.read() : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpMessage . I have org.apache.httpcore-sources.jar in the classpath. The file which currently poses problem is: ontologydesignpatterns.org/cp/owl/timeindexedpersonrole.owl I saved it with Protege as RDF/XML, trying with both extensions .owl and .rdf . The code: public static

Jena Fuseki assembler file + TDB + OWL reasoner

末鹿安然 提交于 2019-12-12 09:02:24
问题 I am having a problem configuring Jena Fuseki using an assembler file. Up until recently I had been starting the server from the command line as follows: sudo ./fuseki-server --loc=la --port=3032 --update /ds This creates a persistent TDB store located in the directory SERVER_ROOT/la. The server starts correctly and displays the following output: 14:30:55 INFO TDB dataset: directory=la 14:30:55 INFO Dataset path = /ds 14:30:55 INFO Fuseki 1.0.1 2014-01-18T19:01:20+0000 14:30:55 INFO Started

SPARQL Querying Transitive

最后都变了- 提交于 2019-12-12 07:26:41
问题 I am a beginner to SPARQL and was wondering if there was a query which could help me return transitive relations. For example the n3 file below I would want a query that would return "a is the sameas c" or something along those lines. Thanks @prefix : <http://websitename.com/links/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . :a owl:sameas :b. :b owl:sameas :c. 回答1: You can use property paths if you are using a suitably enabled SPARQL 1.1 engine, you've tagged your question Jena so I

RiotException when loading a Model using Jena 2.12.1

亡梦爱人 提交于 2019-12-12 06:10:06
问题 I've created this simple class named RDFReader for loading a model from a URI from DBpedia: import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.util.FileManager; public class RDFReader { public static Model readFromURL(String URL){ try{ return (new FileManager()).loadModel(URL); }catch(Exception e){ e.printStackTrace(); } return null; } public static void main(String[] args) { RDFReader.readFromURL("http://dbpedia.org/resource/Pacific_Rim_(film)"); } } I've used Jena v2.12.1 as