Giter Site home page Giter Site logo

Comments (10)

Galigator avatar Galigator commented on June 4, 2024

Version 2.6.1 ? Do you have a small ontology that produce the error ? something I could try.

from openllet.

Galigator avatar Galigator commented on June 4, 2024

It is possible that the problem came from the rule itself. Sometime the production of a predicat (wapa:hasQuantityValue(?c, ?moved)) can lead to application of the rule one more time. Then the new predicat lead to application one more time etc... The endless loop is logical not in the reasonner.

That why I absolutely need the ontology to understand what is the problem.

from openllet.

JackJackie avatar JackJackie commented on June 4, 2024

Hi @Galigator, the version we use is 2.6.0. Well, the rule does work with the Pellet reasoner in Protege, so, I assume that the rule itself is correct. I'll attach the turtle-file as .txt.
bigtu-wapa-model+instances.txt

Hopefully, you can use it to find out what the problem is.

Thanks again, Jack

from openllet.

Galigator avatar Galigator commented on June 4, 2024

Thx for the ontology.
I have made some trys with the OwlApi(like Protege) and it looks okay.

Also when using jena with Openllet 2.6.2, there is no java.lang.StackOverflowError .
But results aren't correct because in openllet-jena some builtin are missing. "date", "substract" are not set.

from openllet.

Galigator avatar Galigator commented on June 4, 2024

By playing around with your ontology.
I manage to create an infinite loop.
It look like ordering on some iterator is important to create the bug.
But most of ordering depend on hashcodes that rely on natives.

By the way, there is no support for swrlb-builtins in the openllet-jena module; maybe I could try to add it.

from openllet.

JackJackie avatar JackJackie commented on June 4, 2024

Hi, thanks for all your efforts!

Good to know that the rule itself is correct. Sorry to hear that the reasoning depends on the order of some iterator. Of course, you are free to add functionality to the openllet-jena module :-). I also look into alternatives to see what kind of SWRL support they provide.

Best, Jack

from openllet.

Galigator avatar Galigator commented on June 4, 2024

I am a stupid hedgehog.

Jena does support the builtins you are using; the builtin that aren't support are only the following ones :
addYearMonthDurations; subtractYearMonthDurations; multiplyYearMonthDuration; divideYearMonthDuration; addDayTimeDurations; subtractDayTimeDurations; multiplyDayTimeDuration; divideDayTimeDuration; subtractDates; subtractTimes; dYearMonthDurationToDateTime; addDayTimeDurationToDateTime;subtractYearMonthDurationFromDateTime; subtractDayTimeDurationFromDateTime; addYearMonthDurationToDate; addDayTimeDurationToDate; subtractYearMonthDurationFromDate; subtractDayTimeDurationFromDate; addDayTimeDurationToTime; subtractDayTimeDurationFromTime: subtractDateTimesYieldingYearMonthDuration; subtractDateTimesYieldingDayTimeDuration;

Then by adding, the namespace that are missing in your file :

@prefix swrl: <http://www.w3.org/2003/11/swrl#> .
@prefix swrlb: <http://www.w3.org/2003/11/swrlb#> .

results are goods with the 2.6.2 :

		@Test
	public void testSWRLConsistencyWithBuiltIn()
	{
		final InputStream stream = AddDelTripleInferenceTest.class.getResourceAsStream("/bigtu-wapa-model.instances.ttl");
		final OntModel ontoModelInferred = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
		ontoModelInferred.read(stream, null, "TURTLE");
		ontoModelInferred.prepare();

		final Resource s = ontoModelInferred.createResource("http://wapa#Moved-Jun-17-1");
		final Property p = ontoModelInferred.createProperty("http://bwapa#hasQuantityValue");
		{

			final Literal o = ontoModelInferred.createTypedLiteral(40.0);
			final Statement stmt = ResourceFactory.createStatement(s, p, o);
			assertTrue(ontoModelInferred.contains(stmt));
		}

		{
			final Literal o = ontoModelInferred.createTypedLiteral(41.0);
			final Statement stmt = ResourceFactory.createStatement(s, p, o);
			assertFalse(ontoModelInferred.contains(stmt));
		}

		ontoModelInferred.listObjectsOfProperty(s, p).forEachRemaining(System.out::println);

	}
``` (I shorten the wapas namespaces to read them faster).

from openllet.

JackJackie avatar JackJackie commented on June 4, 2024

Thx for all the work! Good to know...I'll try to make it work in our Jena Fuseki server!

Best, Jack.

from openllet.

Galigator avatar Galigator commented on June 4, 2024

Did you make it work with success ?

from openllet.

JackJackie avatar JackJackie commented on June 4, 2024

Hi, to be honest...unfortunately not!
We downloaded your 2.6.3 version of openllet, build the .jar files and incorporated them into our Apache Jena Fuseki config file to call the reasoner via the "openllet.jena.PelletReasonerFactory" class as shown below.

So, the facts are that the ontology and reasoning works with Protege, with your implementation but not in Jena Fuseki. And thus the problem will somewhere in there, meaning that Jena Fuseki uses your openllet implementation differently.

Next step would be to dive into the Jena Fuseki source code to find out how the openllet reasoner is being used. However, we are reluctant to do that as it takes a lot of time. So, a good example of how others are using the combination of Jena Fuseki and openllet would be welcome.

# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .

[] rdf:type fuseki:Server ;
	fuseki:services (
	<#service1>
	) .

# Custom code.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

# TDB
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .

## ---------------------------------------------------------------
## Service with only SPARQL query on an inference model.
## Inference model bbase data in TDB.

<#service1> rdf:type fuseki:Service ;
	fuseki:name "pizza" ; # http://host/pizza
	fuseki:serviceQuery "query" ; # SPARQL query service
	fuseki:serviceUpdate "update" ;
	fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
	fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
	# A separate read-only graph store endpoint:
	fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol (read only)
	fuseki:dataset <#dataset> .

<#dataset> rdf:type ja:RDFDataset ;
	ja:defaultGraph <#model_inf> .

<#model_inf> a ja:InfModel ;
	ja:baseModel <#tdbGraph> ;
	ja:content <#test-inf> ;
	ja:reasoner [
#		ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner>
		ja:reasonerClass "openllet.jena.PelletReasonerFactory"
	] .

<#tdbGraph> rdf:type tdb:GraphTDB ;
	tdb:dataset <#tdbDataset> .

<#tdbDataset> rdf:type tdb:DatasetTDB ;
	tdb:location "DB" ;
	#set the timeout for a SPARQL query in milliseconds. 0 means no timeout and the query never times out.
	ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "0" ] .

<#test-inf> ja:externalContent <file:///opt/ontology-plus-data.ttl> .

from openllet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.