OK, I simplified the SparqlMotion script so it includes an
ImportFromRDF module and an ApplyJenaRules module. When I run it the
first time after opening the SparqlMotion script, it executes
successfully but still does not include any inferred triples in the
results. When I look at the Error log, there is a warning message for
each of my rules.
The title of the warning is: Warning: Ignoring SWRL rule .....<rule
text>...
The stack trace for the warning is:
java.lang.NullPointerException
at com.hp.hpl.jena.ontology.impl.OntResourceImpl.getRDFType
(OntResourceImpl.java:781)
at com.hp.hpl.jena.ontology.impl.OntResourceImpl.getRDFType
(OntResourceImpl.java:758)
at org.topbraid.rules.swrl.SWRL2Jena.appendAtomList(SWRL2Jena.java:42)
at org.topbraid.rules.swrl.SWRL2Jena.appendLabel(SWRL2Jena.java:134)
at org.topbraid.rules.swrl.SWRL2Jena.getRule(SWRL2Jena.java:180)
at org.topbraid.rules.inference.AllRulesProvider.getSWRLImps
(AllRulesProvider.java:91)
at org.topbraid.rules.inference.AllRulesProvider.getRules
(AllRulesProvider.java:79)
at
org.topbraid.sparqlmotion.lib.applyJenaRules.ApplyJenaRulesModule.createGraph
(ApplyJenaRulesModule.java:27)
at org.topbraid.sparqlmotion.modules.impl.AbstractModule.getRDFOutput
(AbstractModule.java:592)
at org.topbraid.sparqlmotion.engine.impl.ExecutionEngine.executeModule
(ExecutionEngine.java:112)
at org.topbraid.sparqlmotion.engine.impl.ExecutionEngine.execute
(ExecutionEngine.java:74)
at
org.topbraidcomposer.sparqlmotion.views.console.SPARQLMotionConsole.execute
(SPARQLMotionConsole.java:41)
at
org.topbraidcomposer.sparqlmotion.actions.AbstractExecuteSPARQLMotionAction
$1.run(AbstractExecuteSPARQLMotionAction.java:141)
at org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:
59)
at java.lang.Thread.run(Thread.java:613)
If I attempt to run it a second time, it fails with the following
error:
Could not execut SPARQLMotion script:
java.lang.reflect.InvocationTargetException
at
org.topbraidcomposer.sparqlmotion.actions.AbstractExecuteSPARQLMotionAction
$1.run(AbstractExecuteSPARQLMotionAction.java:150)
at org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:
59)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.NullPointerException
at com.hp.hpl.jena.ontology.impl.OntResourceImpl.getRDFType
(OntResourceImpl.java:781)
at com.hp.hpl.jena.ontology.impl.OntResourceImpl.getRDFType
(OntResourceImpl.java:758)
at org.topbraid.rules.swrl.SWRLLabelsPlugin.appendAtomList
(SWRLLabelsPlugin.java:48)
at org.topbraid.rules.swrl.SWRLLabelsPlugin.appendLabel
(SWRLLabelsPlugin.java:108)
at org.topbraid.strings.LabelsPlugins.appendLabel(LabelsPlugins.java:
40)
at org.topbraid.strings.Labels.append(Labels.java:179)
at org.topbraid.strings.Labels.getLabel(Labels.java:525)
at org.topbraid.strings.Labels.getLabel(Labels.java:499)
at org.topbraid.rules.inference.AllRulesProvider.getSWRLImps
(AllRulesProvider.java:96)
at org.topbraid.rules.inference.AllRulesProvider.getRules
(AllRulesProvider.java:79)
at
org.topbraid.sparqlmotion.lib.applyJenaRules.ApplyJenaRulesModule.createGraph
(ApplyJenaRulesModule.java:27)
at org.topbraid.sparqlmotion.modules.impl.AbstractModule.getRDFOutput
(AbstractModule.java:592)
at org.topbraid.sparqlmotion.engine.impl.ExecutionEngine.executeModule
(ExecutionEngine.java:112)
at org.topbraid.sparqlmotion.engine.impl.ExecutionEngine.execute
(ExecutionEngine.java:74)
at
org.topbraidcomposer.sparqlmotion.views.console.SPARQLMotionConsole.execute
(SPARQLMotionConsole.java:41)
at
org.topbraidcomposer.sparqlmotion.actions.AbstractExecuteSPARQLMotionAction
$1.run(AbstractExecuteSPARQLMotionAction.java:141)
... 2 more
Any idea why this would fail in SparqlMotion yet work fine when I run
the rules when I'm viewing the Owl file directly?
Thanks,
Kev
On Apr 2, 11:19 am, Holger Knublauch <[email protected]> wrote:
> Hi Kevin,
>
> it should work if you just use sml:ApplyJenaRules - this includes Jena
> rules and SWRL rules. The sml:ApplyJenaInferencing is for the built-in
> Jena inference configurations such as OWL and RDFS.
>
> Note that even after you run this script, it will - by default - not
> affect the current Inferences View of TBC. You will simply get the new
> triples as result of the script, and can then determine what to do
> next, e.g. stream it to a new file, or display them and infer them
> temporarily.
>
> Holger
>
> On Apr 2, 2009, at 7:48 AM, Kevin Matthews wrote:
>
>
>
> > I have an owl file that contains many SWRL rules. When I open the
> > file, configure inferencing to run "SWRL and Jena Rules", and run
> > inferencing, it generates a series of inferred triples in the
> > Inferences window as expected.
>
> > However, I cannot figure out how to replicate this functionality in a
> > SparqlMotion script.
>
> > I currently have a SparqlMotion script that contains 2 modules. The
> > first module imports the RDF from the owl file. The second module is
> > an ApplyJenaInferencing module with all default values. When I run
> > the script, the SparqlMotionResults window is populated with all the
> > triples of the OWL file, but no inferred triples. The Inferences
> > window remains empty. I have configured inferencing for the
> > SparqlMotion script to use "SWRL and Jena Rules".
>
> > How do I get the ApplyJenaInferencing module to add the inferred
> > triples to the output? Can I query the inferred triples any other
> > way? Do I need to add an ApplyJenaRules module to the mix? If so,
> > does it belong before or after the ApplyJenaInferencing module?
>
> > Any help would be greatly appreciated.
>
> > Thanks,
>
> > Kevin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TopBraid Composer Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---