Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] SQWRL through Java

Martin O'Connor martin.oconnor at stanford.edu
Wed Oct 22 03:41:48 PDT 2008


The parser is expecting the SWRLParser.AND_CHAR and IMP_CHAR Unicode  
characters for the ASCII ^ and ->. I will update it to automatically  
handle the ASCII characters in the next release.

Martin

Quoting Michael Lodemann <milo at informatik.uni-kiel.de>:

> Thanks Samson!
>> Had you set " -Dprotege.dir=YourProtegeInstalationDirectory" as a Java
>> VM argument when you invoke your application? It tells Protege where to
>> load sqwrl.owl.
>>
>>
> ...but I still receive the same error, although something has been
> loaded ... but I think unfortunately not the sqwrl.owl.
>
> Can you interpret the console output when running my program?
> Protege 3.4 Build 506, JVM 1.6.0_07-b06, memory=66M, Windows Vista,
> encoding=UTF-8, language=de, country=DE
> Loaded plugin edu.stanford.smi.protegex.owl - OWL Plugin
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.conditions.ConditionsWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.ResourceListWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.domain.OWLDomainWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.database.OWLDatabaseKnowledgeBaseFactory
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.cls.ClassAnnotationsAndDescriptionWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.storage.ProtegeFromOWLFilesCreateProjectPlugin
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadatatab.OWLMetadataTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.MultiResourceWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadatatab.OntologyURIWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.OWLDateTimeWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadatatab.OWLNamespacesWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.MultiLiteralWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.swrl.ui.SWRLProjectPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.SingleLiteralWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.export.JenaTurtleFileExportPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.OWLPropertiesTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.cls.OWLClassesTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.importer.JenaImportPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.range.OWLRangeWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.conditions.AssertedConditionsWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.export.JenaExportPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.conditions.InferredConditionsWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.types.OWLDatatypePropertyTypesWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.types.RDFPropertyTypesWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.clsdesc.DisjointClassesWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.export.JenaN3FileExportPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.SingleResourceWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.export.JenaNTripleFileExportPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadata.AnnotationsWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.OWLTimeWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.OWLInversePropertyWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.database.CreateOWLDatabaseProjectPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.cls.ClassTypeConverterWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.ClassFormWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadata.OWLMetadataWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.swrl.ui.tab.SWRLTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.RDFSSubClassOfWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.RDFListWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadata.RDFSNamedClassMetadataWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.individuals.OWLIndividualsTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.OWLDateWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.cls.SwitchableClassDefinitionWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.DataRangeFieldWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.RDFPropertiesWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.properties.types.OWLObjectPropertyTypesWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.OWLFormsTab --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.swrl.ui.widget.SWRLRuleSlotWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.database.CreateOWLDatabaseFromFileProjectPlugin
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.InferredSuperClassesWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.SingleLiteralAreaWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.menu.OWLMenuProjectPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.clsproperties.PropertyRestrictionsTreeWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.HeaderWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.jena.OWLFilesCreateProjectPlugin --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.OWLFormWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadatatab.alldifferent.AllDifferentWidget
> -- PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.metadata.NameDocumentationWidget --
> PluginUtilities.checkPlugin()
> WARNING: Duplicate plugin:
> edu.stanford.smi.protegex.owl.ui.widget.ExternalResourceURLWidget --
> PluginUtilities.checkPlugin()
> Loaded plugin ca.uvic.cs.chisel.jambalaya - Jambalaya
> Loaded plugin dfki.protege.ontoviz
> Loaded plugin edu.stanford.smi.protegex.rdf_backend - RDF Backend
> Loaded plugin edu.stanford.smi.protegex.changes - Changes tab
> Loaded plugin edu.stanford.smi.protegex.standard_extensions - Graph
> Widget, Table Widget
> Loaded plugin edu.stanford.smi.protegex.chatPlugin - Chat
> Loaded plugin edu.stanford.smi.protege.collab - Collaborative Protege
> Loaded plugin edu.stanford.smi.protege.script - Script Plugin
> Loaded plugin edu.stanford.smi.protege.stringsearch - String Search Tab
> Loaded plugin edu.stanford.smi.protegex.datamaster - DataMaster Tab
> Loaded plugin edu.stanford.smi.protegex.pal_tabs - PAL Tabs
> Loaded plugin edu.stanford.smi.protegex.ezpal - EZPal Tab
> Loaded plugin edu.stanford.smi.protegex.facets_tab
> Loaded plugin edu.stanford.smi.protegex.instance_tree
> Loaded plugin edu.stanford.smi.protegex.owl.inference.pellet - Protege
> Pellet Reasoner
> Loaded plugin edu.stanford.smi.protegex.prompt - PROMPT Tab
> Loaded plugin edu.stanford.smi.protegex.umls_tab - UMLS Tab
> Loaded plugin edu.stanford.smi.protegex.wordnet - WordNet Tab
> Loaded plugin edu.stanford.smi.protegex.xml_tab - XML Tab
> Loaded plugin org.algernon - Algernon
> Loaded plugin se.liu.ida.JessTab - JessTab Plugin
> Loaded plugin uk.ac.iam.soton.akt.tgviztab - TGVizTab
> Loaded plugin uk.ac.man.cs.mig.coode.debugger
> Loaded plugin uk.ac.man.cs.mig.coode.manchesterowlsyntaxeditor
> Loaded plugin uk.ac.man.cs.mig.coode.owldoc
> Loaded plugin uk.ac.man.cs.mig.coode.owlindividualstab
> Loaded plugin uk.ac.man.cs.mig.coode.owlviz
> Loaded plugin uk.ac.man.cs.mig.coode.protege.wizard - Basic Wizards
> Loaded plugin uk.ac.man.cs.mig.coode.protege.wizard.owl - OWL Wizards
> Invalid identifier: '^'.
>
> I hope you can help me.
>
> best regards,
> Michael
>
>> Samson
>>
>> Michael Lodemann wrote:
>>
>>> It is all strange.
>>> Seems the sqwrl.owl is not imported.
>>>
>>> I receive a SWRLParseException
>>> "Invalid identifier: '^'."
>>> while executing the query
>>> SWRLImp imp = factory.createImp("Person(?p) ^ age(?p, ?a) ->
>>> sqwrl:select(?p, ?a)");
>>>
>>> and like before "Invalid atom name 'sqwrl:count'."
>>> while executing the query
>>> SWRLImp imp = factory.createImp("Query-2", "Person(?p) ->   
>>> sqwrl:count(?p)");
>>> or similar queries.
>>>
>>> I'm really stuck. I hope someone can help me.
>>>
>>> confused,
>>> Michael
>>>
>>>
>>> <snip>
>>>
>>> package test;
>>>
>>> import java.util.Collection;
>>> import edu.stanford.smi.protegex.owl.ProtegeOWL;
>>> import edu.stanford.smi.protegex.owl.model.OWLDatatypeProperty;
>>> import edu.stanford.smi.protegex.owl.model.OWLModel;
>>> import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
>>> import edu.stanford.smi.protegex.owl.model.OWLObjectProperty;
>>> import edu.stanford.smi.protegex.owl.model.RDFIndividual;
>>> import edu.stanford.smi.protegex.owl.swrl.model.SWRLFactory;
>>> import edu.stanford.smi.protegex.owl.swrl.model.SWRLImp;
>>>
>>> public class importando2 {
>>>
>>>     public static void main(String[] args ){
>>>         try{
>>>             OWLModel owlModel = ProtegeOWL.createJenaOWLModel();
>>>
>>>             OWLNamedClass personClass =
>>> owlModel.createOWLNamedClass("Person");
>>>
>>>             OWLDatatypeProperty ageProperty =
>>> owlModel.createOWLDatatypeProperty("hasAge");
>>>             ageProperty.setRange(owlModel.getXSDint());
>>>             ageProperty.setDomain(personClass);
>>>
>>>             OWLObjectProperty childrenProperty =
>>> owlModel.createOWLObjectProperty("children");
>>>             childrenProperty.setRange(personClass);
>>>             childrenProperty.setDomain(personClass);
>>>
>>>             RDFIndividual darwin =   
>>> personClass.createRDFIndividual("Darwin");
>>>             darwin.setPropertyValue(ageProperty, new Integer(1));
>>>
>>>             RDFIndividual holgi =   
>>> personClass.createRDFIndividual("Holger");
>>>             holgi.setPropertyValue(childrenProperty, darwin);
>>>             holgi.setPropertyValue(ageProperty, new Integer(33));
>>>
>>>             SWRLFactory factory = new SWRLFactory(owlModel);
>>> //            SWRLImp imp = factory.createImp("Query-1", "sameAs(Darwin,
>>> Holger)");
>>>             SWRLImp imp = factory.createImp("Person(?p) ^ age(?p, ?a) ->
>>> sqwrl:select(?p, ?a)");
>>>
>>> //            SWRLImp imp = factory.createImp("Query-2", "Person(?p) ->
>>> sqwrl:count(?p)");
>>>             Collection col = imp.getReferencedInstances();
>>>             System.out.println("elements: "+col.toString());
>>>
>>>         }catch(Exception error){
>>>              System.out.println(error.getMessage());
>>>          }
>>>     }
>>> }
>>>
>>> </snip>
>>> _______________________________________________
>>> protege-owl mailing list
>>> protege-owl at lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>>
>>> Instructions for unsubscribing:   
>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>>
>>
>> _______________________________________________
>> protege-owl mailing list
>> protege-owl at lists.stanford.edu
>> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>>
>> Instructions for unsubscribing:   
>> http://protege.stanford.edu/doc/faq.html#01a.03
>>
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing:   
> http://protege.stanford.edu/doc/faq.html#01a.03
>





More information about the protege-owl mailing list