Discussion:
schemagen hangs
Florian Kleedorfer
2017-02-22 18:04:14 UTC
Permalink
Hi!

I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl

using these options (through maven in the example below, but I get the
same results from the command line)

-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]

With these settings, no object properties are to be found in the
resulting files, which is not what I want.

If I add the '--inference' option, generating the class works for c) and
I get the properties - but neither for a) nor b): in both cases, the
program seems to hang, probably indefinitely. I thread-debugged and it
seems to me that the program hangs in the writeRDFProperties() method
(schemagen:926 in jena 2.12.1) - iterating over the statements iterator
never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their ready
flag never seems to change to true.

I tried to load the ontology files using a normal OntModel with the same
Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can print
out the model after reasoning (which I suspect should do the same as
above: iterating over the statements in the model).

Using binary search (deleting the bottom half of the logico.ttl file
until schemagen would not show this behaviour any more) I found that in
this part
https://gist.github.com/fkleedorfer/866e0bdfb90a1621a865c5879c02a734
(original file until line 191), the problem still persists, but if the
last restriction is removed, the problem goes away (of course, not
leaving me with any useful result).

Any help is appreciated, thanks in advance!

Best
Florian
Lorenz B.
2017-02-23 08:49:17 UTC
Permalink
Any reason for using such an old version of Jena? Latest version is
3.1.0 for schemagen.
Post by Florian Kleedorfer
Hi!
I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl
using these options (through maven in the example below, but I get the
same results from the command line)
-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]
With these settings, no object properties are to be found in the
resulting files, which is not what I want.
If I add the '--inference' option, generating the class works for c)
and I get the properties - but neither for a) nor b): in both cases,
the program seems to hang, probably indefinitely. I thread-debugged
and it seems to me that the program hangs in the writeRDFProperties()
method (schemagen:926 in jena 2.12.1) - iterating over the statements
iterator never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their
ready flag never seems to change to true.
I tried to load the ontology files using a normal OntModel with the
same Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can
print out the model after reasoning (which I suspect should do the
same as above: iterating over the statements in the model).
Using binary search (deleting the bottom half of the logico.ttl file
until schemagen would not show this behaviour any more) I found that
in this part
https://gist.github.com/fkleedorfer/866e0bdfb90a1621a865c5879c02a734
(original file until line 191), the problem still persists, but if the
last restriction is removed, the problem goes away (of course, not
leaving me with any useful result).
Any help is appreciated, thanks in advance!
Best
Florian
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Florian Kleedorfer
2017-02-23 15:28:21 UTC
Permalink
Thank you for pointing that out! I changed the code to use 3.1.0 - the
problem remains.
Post by Lorenz B.
Any reason for using such an old version of Jena? Latest version is
3.1.0 for schemagen.
Post by Florian Kleedorfer
Hi!
I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl
using these options (through maven in the example below, but I get the
same results from the command line)
-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]
With these settings, no object properties are to be found in the
resulting files, which is not what I want.
If I add the '--inference' option, generating the class works for c)
and I get the properties - but neither for a) nor b): in both cases,
the program seems to hang, probably indefinitely. I thread-debugged
and it seems to me that the program hangs in the writeRDFProperties()
method (schemagen:926 in jena 2.12.1) - iterating over the statements
iterator never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their
ready flag never seems to change to true.
I tried to load the ontology files using a normal OntModel with the
same Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can
print out the model after reasoning (which I suspect should do the
same as above: iterating over the statements in the model).
Using binary search (deleting the bottom half of the logico.ttl file
until schemagen would not show this behaviour any more) I found that
in this part
https://gist.github.com/fkleedorfer/866e0bdfb90a1621a865c5879c02a734
(original file until line 191), the problem still persists, but if the
last restriction is removed, the problem goes away (of course, not
leaving me with any useful result).
Any help is appreciated, thanks in advance!
Best
Florian
Andy Seaborne
2017-02-26 18:12:44 UTC
Permalink
Hi Florian,

Could you please create JIRA ticket for this?

Thanks
Andy
Post by Florian Kleedorfer
Thank you for pointing that out! I changed the code to use 3.1.0 - the
problem remains.
Post by Lorenz B.
Any reason for using such an old version of Jena? Latest version is
3.1.0 for schemagen.
Post by Florian Kleedorfer
Hi!
I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl
using these options (through maven in the example below, but I get the
same results from the command line)
-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]
With these settings, no object properties are to be found in the
resulting files, which is not what I want.
If I add the '--inference' option, generating the class works for c)
and I get the properties - but neither for a) nor b): in both cases,
the program seems to hang, probably indefinitely. I thread-debugged
and it seems to me that the program hangs in the writeRDFProperties()
method (schemagen:926 in jena 2.12.1) - iterating over the statements
iterator never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their
ready flag never seems to change to true.
I tried to load the ontology files using a normal OntModel with the
same Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can
print out the model after reasoning (which I suspect should do the
same as above: iterating over the statements in the model).
Using binary search (deleting the bottom half of the logico.ttl file
until schemagen would not show this behaviour any more) I found that
in this part
https://gist.github.com/fkleedorfer/866e0bdfb90a1621a865c5879c02a734
(original file until line 191), the problem still persists, but if the
last restriction is removed, the problem goes away (of course, not
leaving me with any useful result).
Any help is appreciated, thanks in advance!
Best
Florian
Dave Reynolds
2017-02-26 21:18:18 UTC
Permalink
Hi,
Post by Florian Kleedorfer
Hi!
I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl
using these options (through maven in the example below, but I get the
same results from the command line)
-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]
With these settings, no object properties are to be found in the
resulting files, which is not what I want.
[I've only looked at logico.ttl in the below.]

Use --ontology. With that (but no --inference) I get *lots* of
ObjectProperties. You shouldn't need inference for a case like this.
Post by Florian Kleedorfer
If I add the '--inference' option, generating the class works for c) and
I get the properties - but neither for a) nor b): in both cases, the
program seems to hang, probably indefinitely. I thread-debugged and it
seems to me that the program hangs in the writeRDFProperties() method
(schemagen:926 in jena 2.12.1) - iterating over the statements iterator
never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their ready
flag never seems to change to true.
I believe is this is just the inefficiency of the rule reasoner for an
ontology like this with it's search space exploding.

It is getting lost trying to follow things like the nest of transitive
and inverse properties declarations in the DUL part of the ontology.
Post by Florian Kleedorfer
I tried to load the ontology files using a normal OntModel with the same
Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can print
out the model after reasoning (which I suspect should do the same as
above: iterating over the statements in the model).
If I try a writeAll on an OWL_MEM_RULE_INF instance of that ontology I
get exactly the same explosion in the reasoner as I see with schemagen.
Might you have been trying a plain write in your test?

Dave
Florian Kleedorfer
2017-02-27 11:14:50 UTC
Permalink
Hi Dave!

Thanks to your comments I managed to get a configuration that produces
the java classes the way I want them, so I think we can end this thread.
Should I still create a JIRA ticket for it, @Andy?

A few remarks:

using --ontology without --inference on 'logiserv.ttl' leads to this
failure: "Execution schemagen of goal
org.apache.jena:jena-maven-tools:3.1.0:translate failed: Cannot convert
node http://ontology.tno.nl/logico#Address to OntClass: it does not have
rdf:type owl:Class or equivalent"

using --ontology without --inference on 'transport.ttl' leads to this
failure: "Execution schemagen of goal
org.apache.jena:jena-maven-tools:3.1.0:translate failed: Cannot convert
node http://ontology.tno.nl/logico#Address to OntClass: it does not have
rdf:type owl:Class or equivalent"

Using --ontology with --inference on these two seems to produce what I want.

Here's the maven configuration:

<plugin>
<groupId>org.apache.jena</groupId>
<artifactId>jena-maven-tools</artifactId>
<version>3.1.0</version>
<configuration>
<includes>
<include>src/main/vocabs/*.ttl</include>
</includes>
<fileOptions>
<source>
<input>src/main/vocabs/logico.ttl</input>
<package-name>won.transport.ont</package-name>
<output>${project.build.directory}/generated-sources/java</output>
<use-inf>false</use-inf>
<ontology>true</ontology>
</source>
<source>
<input>src/main/vocabs/logiserv.ttl</input>
<package-name>won.transport.ont</package-name>
<output>${project.build.directory}/generated-sources/java</output>
<use-inf>true</use-inf>
<ontology>true</ontology>

</source>
<source>
<input>src/main/vocabs/transport.ttl</input>
<package-name>won.transport.ont</package-name>
<output>${project.build.directory}/generated-sources/java</output>
<use-inf>true</use-inf>
<ontology>true</ontology>
</source>
</fileOptions>
</configuration>
<executions>
<execution>
<id>schemagen</id>
<goals>
<goal>translate</goal>
</goals>
</execution>
</executions>
</plugin>
Post by Dave Reynolds
Hi,
Post by Florian Kleedorfer
Hi!
I am trying to use schemagen (jena 2.12.1) on three ontologies found
here: http://ontology.tno.nl/
namely
a) http://ontology.tno.nl/logico.ttl,
b) http://ontology.tno.nl/logiserv.ttl
c) http://ontology.tno.nl/transport.ttl
using these options (through maven in the example below, but I get the
same results from the command line)
-i [file] \
-e TTL \
--package won.transport.ont \
-o ${project.build.directory}/generated-sources/java \
-n [classname]
With these settings, no object properties are to be found in the
resulting files, which is not what I want.
[I've only looked at logico.ttl in the below.]
Use --ontology. With that (but no --inference) I get *lots* of
ObjectProperties. You shouldn't need inference for a case like this.
Post by Florian Kleedorfer
If I add the '--inference' option, generating the class works for c) and
I get the properties - but neither for a) nor b): in both cases, the
program seems to hang, probably indefinitely. I thread-debugged and it
seems to me that the program hangs in the writeRDFProperties() method
(schemagen:926 in jena 2.12.1) - iterating over the statements iterator
never ends. Code execution hangs in the loop in
com.hp.hpl.jena.reasoner.rulesys.impl.LPBRuleEngine#pump (line 304).
There are 3 generators in the collection called 'batch', and their ready
flag never seems to change to true.
I believe is this is just the inefficiency of the rule reasoner for an
ontology like this with it's search space exploding.
It is getting lost trying to follow things like the nest of transitive
and inverse properties declarations in the DUL part of the ontology.
Risking to be side-tracked here: What do you mean by DUL part of the
ontology?
Post by Dave Reynolds
Post by Florian Kleedorfer
I tried to load the ontology files using a normal OntModel with the same
Reasoner that is used by schemagen( OWL_MEM_RULE_INF) and I can print
out the model after reasoning (which I suspect should do the same as
above: iterating over the statements in the model).
If I try a writeAll on an OWL_MEM_RULE_INF instance of that ontology I
get exactly the same explosion in the reasoner as I see with
schemagen. Might you have been trying a plain write in your test?
yes, correct. With writeAll I get the same behaviour as through schemagen.

Cheers,
Florian

Loading...