jena

Java code for Converting string message into Jena model

荒凉一梦 提交于 2020-01-03 06:19:08
问题 I have a string message from an AMQP message broker that consists of RDF statements. I want to covert it into a Jena model using Java and then merge the converted model with another one into single model. How can I do this? 回答1: This can be divided into three logical steps. Some of these, you may have already done: Isolate the RDF statements from non-rdf text Identify the syntax used for the RDF (can be part of #1) Parse the resulting string into an Apache Jena Model . As the first two are

Jena Ontology API how to retrieve axiom that attach annotation to a class property relation

不想你离开。 提交于 2020-01-03 05:23:10
问题 I have annotated the relationship described below TV subClassof : Restriction {hasFeature some PowerConsumption} ::: @isNegative=true. The TV class has a Object property called hasFeature with values in class PowerConsumption . The annotation is applied to this property relation. The OWL file gets added with the following axiom to represent the added annotation. How can I retrieve this axiom and get the annotation value of isNegative using Jena? <owl:Axiom> <isNegative>true</isNegative> <owl

For an OWL class A; Getting all properties that A is their domain

≯℡__Kan透↙ 提交于 2020-01-03 05:12:05
问题 First I know this topic maybe repeated, but actually I have further questions. I'm using Jena to manipulate OWL ontology. Given a class A , I want to find all properties that A is their domain whether this is explicit or inferred. Let's consider the following ontology: A1 subClassOf A; P domain A; P range B; I create an ontology moel with DL rule inference, this is supposed to turn reasoner on. ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF) A work around introduced two

Problem of reading OWL/XML

青春壹個敷衍的年華 提交于 2020-01-02 09:59:29
问题 I have a problem reading OWL/XML files from Java using Jena. I have no problem reading RDF/XML files, but whenever I create a OWL/XML file from Protege and try to read it, Java gives this error below : WARN [main] (RDFDefaultErrorHandler.java:36) Exception in thread "main" java.lang.NullPointerException at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.endElement(XMLHandler.java:143) The code that I use to retrieve RDF/XML is below : OntModel ontModel = ModelFactory.createOntologyModel();

Jena: How to infer data / performance issues

喜欢而已 提交于 2020-01-02 03:40:05
问题 I'd like to use Jena's inference capabilities, but I'm having some performance problems when I am using InfModel. Here's a simplified overview of my ontology: Properties: hasX (Ranges(intersection): X, inverse properties: isXOf) |-- hasSpecialX (Ranges(intersection): X, inverse properties: isSpecialXOf) isXOf (Domains(intersection): X, inverse properties: hasX) |--isSpecialXOf (Domains(intersection): X, inverse properties: hasSpecialX) Furthermore there's a class 'Object': Object hasSpecialX

Toggle Jena Reasoner

这一生的挚爱 提交于 2020-01-01 00:21:27
问题 I have a Jena ontology model (OntModel) which I'm modifying programatically. This model was initially created using the default ModelFactory method to create an Ontology model (with no parameters). The problem was, as the program ran and the model was changed, the default Jena Reasoner would run (and run and run and run). The process was entirely too slow for what I need and would run out of memory on large data sets. I changed the program to use a different ontology model factory method to

object property for a class

左心房为你撑大大i 提交于 2019-12-31 07:18:06
问题 How can I determine object properties for a class in Jena . I can get the all objects properties, but I want to get the object properties for a particular class. Code for getting all the objectProperties: ExtendedIterator objects = m.listObjectProperties(); while (objects.hasNext()) { Property essaProperty = (Property) objects.next(); System.out.println("Propiedad: " + essaProperty.getLocalName()); } Also, how I can get the related class to the object property, I mean, knowing A how I can get

How to list and count the different types of node and edge entities in the graph data using SPARQL query?

江枫思渺然 提交于 2019-12-31 03:02:52
问题 I'm looking to provide some summary stats for a data set and I want to list the different types of edge entities and node(vertex) entities in the graph. For example: -> In Twitter Social network graph of users and following relationship (Homogeneous graph), there is only one type of vertex entity (user), but in heterogeneous graphs such as ConceptNet data, it will have multiple values. -> The edge entities can be computed by just counting the different number of predicates I believe using the

Reasoning with Fuseki, TDB and named graphs?

霸气de小男生 提交于 2019-12-30 09:31:57
问题 I'm serving a dataset containing 10-20 named graphs from a TDB dataset in Fuseki 2. I'd like to use a reasoner to do inference on my data. The behaviour I'd like to see is that triples inferred within each graph should appear within those graphs (although it would be fine if the triples appear in the default graph too). Is there a simple way of configuring this? I haven't found any configuration examples that match what I am trying to do. The configuration I've tried is very similar to the

Query DBpedia with Sparql using VALUES

邮差的信 提交于 2019-12-25 18:43:27
问题 When I run this code in java I am getting error, I think the error occurred because of "String values". I am not sure about adding it but I got this idea from my previous question's answer which I asked in this site Query DBpedia to get abstract for different inputs public static void DbpediaResultSparql() { String values = "New York"; String service = "http://dbpedia.org/sparql"; String sparqlQueryString2 = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+ "PREFIX dbpedia-owl: <http:/