Hi Kevin, I have located a bug in the SPARQLMotion module to run SWRL rules. This will be fixed in the next 3.0.0 release (which we are working on right now). Please note that you will still need to also import the system triples as they are expected by the SWRL processor.
Having said this, as Scott also points out, SWRL is not the only option for rules, and I would recommend using SPARQL/SPIN, or Jena rules directly. Thanks for your patience and bug report Holger On Apr 2, 2009, at 11:56 AM, Kevin Matthews wrote: > > I have added a ImportSystemTriples module and the errors continue. > > I first chained the modules together: > > Import My Owl -> Import System Triples -> Apply Rules > This threw no error, but the triples from my owl file were overwritten > by the system triples and did not appear in the output. > > Then > > Import System Triples -> Import My Owl -> Apply Rules > This threw a NullPointer at the same line as before. > > Then > > Import My Owl -> -> Apply Rules > Import System Triples -> Apply Rules > This threw a NullPointer as well. > > Finally, I looked at all the imports of my owl file replicated those > imports in my SparqlMotion import window. This too had no affect. > > I'm really stuck here until I can figure out a way to infer triples > based on rules. Please let me know if you can think of any other ways > I can move forward. > > > Thanks, > > Kevin > > > On Apr 2, 2:17 pm, Holger Knublauch <[email protected]> wrote: >> The difference is most likely that sml:ImportRDFFromWorkspace does >> not >> include the system triples into the graph - only the imports. Then >> some code in the SWRL parser currently fails. As a work-around (which >> I did not confirm yet) please try adding sml:ImportSystemTriples as >> well, so that the inferencing module has two predecessors as input. >> >> I will meanwhile see how to make the code more robust in that case. >> >> Thanks for the report. >> Holger >> >> On Apr 2, 2009, at 10:49 AM, Kevin Matthews wrote: >> >> >> >>> 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 -~----------~----~----~----~------~----~------~--~---
