GithubHelp home page GithubHelp logo

Comments (6)

martinjoconnor avatar martinjoconnor commented on August 11, 2024

Can you post the ontology. (Change .owl extension to .txt because GitHub does not allow the former.)

from swrlapi-example.

sagilar avatar sagilar commented on August 11, 2024

Here is the ontology:
I have tried some things else:

  • I ran the ontology in Java by calling the ontology file:
OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
            OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(new File("Automation-I4.0-Min-Ontology.owl"));

Unfortunately, it does not run. It always shows an error when loading the ontology and making the reasoning:

[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type rdf:PlainLiteral to xsd:string.

If I try to delete this rule, any other rule or query containing a similar statement swrlb:contains(?somevariable,"anystring") makes the error to occur.

  • I went to Protégé again and tried to change the SWRL rules with such problem. I changed swrlb:contains(?somevariable,"anystring"^^rdf:PlainLiteral) which Protégé shows me by default, to swrlb:contains(?somevariable,"anystring"^^xsd:string). It seems to be fine when changing the rules; I save and close, but when opening again, Protégé shows me the same "anystring"^^rdf:PlainLiteral in any declared string.
  • I tried some SQWRL queries in Protégé with the swrlb:contains(?somevariable,"anystring") and it throws me the same error. The rules and queries that do not involve this statement, are ok.

I need to say that Pellet is the only reasoner that runs well with my ontology, at least in Protégé. Should I consider to set the Pellet reasoner in the Java code?

Many thanks in advance.


Edited:

I commented out the rules where the swrlb:contains(?somevariable,"anystring") statement appears and now the ontology and the reasoner are working.
To correct the swrlb:contains problem I changed some <Literal>anystring</Literal> to <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#string">anystring</Literal>. It does not work yet, but at least Protégé does not show ^^rdf:PlainLiteral in the rules of the SWRL Tab anymore.
I'm not sure what is causing the problem, maybe you can explain me better.

The other thing is that after commenting out the conflict rules, I run the reasoner in the Java code and it prints several inferred results with the next code:

SWRLRuleEngine swrlEngine = SWRLAPIFactory.createSWRLRuleEngine(ontology);
            swrlEngine.infer();
            Set<OWLAxiom> inferredOWLAxioms = swrlEngine.getInferredOWLAxioms();
            for(OWLAxiom axiom : inferredOWLAxioms)
            {
                System.out.println("Inferred axiom: " + axiom);
            }

The inferences look like not being too important and information-provider, how could I select only the important ones? is there any way?
I added a txt file with some of the result inferences, this way, perhaps you can explain me better how to understand them (and use correctly).

Many many thanks in advance.

BR,
Santiago

inferences.txt

Automation-I4.0-Min-Ontology - textformat.txt

from swrlapi-example.

sagilar avatar sagilar commented on August 11, 2024

Hi again.
I tried with different resources and it is running fine in the java code, but only when I comment out the SWRL rules and SQWRL queries with problems, i.e., all the SWRL rules and SQWRL queries which has a swrlb:contains(?somevariable,"anystring").
I have done many things to check if the error disappears where the code is failing:

<BuiltInAtom IRI="http://www.w3.org/2003/11/swrlb#contains">
                <Variable IRI="#cont"/>
                <Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#string">SoftwareResource</Literal>
</BuiltInAtom>

or

<BuiltInAtom IRI="http://www.w3.org/2003/11/swrlb#contains">
                <Variable IRI="#cont"/>
                <Literal>SoftwareResource</Literal>
</BuiltInAtom>

even

<BuiltInAtom IRI="http://www.w3.org/2003/11/swrlb#contains">
                <Variable IRI="#cont"/>
                <Literal datatypeIRI="xsd:string">SoftwareResource</Literal>
</BuiltInAtom>

Unfortunately, no one has worked. Also in the Protégé interface with "SoftwareResource" or "SoftwareResource"^^xsd:string but no luck!
I could comment out to test the other rules and queries, but it is essential to count on them.

P.S:
I am sure that in previous tests all these rules and queries worked; I don't know if it is because of some new pluggin or perhaps it happened after merging the ontologies (I merged some ontologies previously in the code that I'm doing the tests).


The complete errors are described here, which were obtained from the Protégé tabs:
SQWRL error:

Using Drools for query execution.

Exception running SQWRL query QueryActiveStates: error running SQWRL queries: error inserting asserted OWL axioms into Drools:
[Error: invoker.invoke("QueryServicesWithDatabaseContent", "swrlb:contains", 0, false, new VPATH($s), new BAVNs("sd", ""), $sd, new L("database", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("QueryServicesW ....}]
             ^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: cannot convert value of type PlainLiteral to xsd:string: error inserting asserted OWL axioms into Drools:
[Error: invoker.invoke("QueryServicesWithDatabaseContent", "swrlb:contains", 0, false, new VPATH($s), new BAVNs("sd", ""), $sd, new L("database", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("QueryServicesW ....}]
             ^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: cannot convert value of type PlainLiteral to xsd:string: [Error: invoker.invoke("QueryServicesWithDatabaseContent", "swrlb:contains", 0, false, new VPATH($s), new BAVNs("sd", ""), $sd, new L("database", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("QueryServicesW ....}]
             ^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: exception thrown by built-in swrlb:contains in rule QueryServicesWithDatabaseContent: cannot convert value of type PlainLiteral to xsd:string: cannot convert value of type PlainLiteral to xsd:string

SWRL error:

The SWRLAPI supports an OWL profile called OWL 2 RL and uses an OWL 2 RL-based reasoner to perform reasoning.
See the 'OWL 2 RL' sub-tab for more information on this reasoner.Exception running rule engine: error running Drools rule engine:
Exception executing consequence for rule "AssignmentDueToCharacteristicDevice" in defaultpkg: [Error: invoker.invoke("RuleForStandardInheritanceDevices", "swrlb:contains", 0, false, new VPATH(), new BAVNs("cont", ""), $cont, new L("Device", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("RuleForStandar ....}]
             ^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string: Exception executing consequence for rule "AssignmentDueToCharacteristicDevice" in defaultpkg: [Error: invoker.invoke("RuleForStandardInheritanceDevices", "swrlb:contains", 0, false, new VPATH(), new BAVNs("cont", ""), $cont, new L("Device", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("RuleForStandar ....}]
             ^
[Line: 1, Column: 1]: [Error: invoker.invoke("RuleForStandardInheritanceDevices", "swrlb:contains", 0, false, new VPATH(), new BAVNs("cont", ""), $cont, new L("Device", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string]
[Near : {... invoker.invoke("RuleForStandar ....}]
             ^
[Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string: exception thrown by built-in swrlb:contains in rule RuleForStandardInheritanceDevices: cannot convert value of type PlainLiteral to xsd:string: cannot convert value of type PlainLiteral to xsd:string

Many thanks in advance,

I keep waiting for your help, and go ahead with my project.

BR,

Santiago.

from swrlapi-example.

martinjoconnor avatar martinjoconnor commented on August 11, 2024

Sorry for the lack of response. I thought you were the same as the person on the Protege mailing list with a similar issue.

See: http://protege-project.136.n4.nabble.com/Protege-is-losing-xsd-string-type-when-I-re-open-it-td4671566.html

You can subscribe to this list here:

https://protege.stanford.edu/support.php

from swrlapi-example.

sagilar avatar sagilar commented on August 11, 2024

Thanks for your quick response.

I returned to use the version 5.2; at least the datatypes are saved when closing protege.
I will prove the rules and queries there, and once done, post here again to check if the problem is the version 5.5 (which I have been using).

Have a good rest of day.

from swrlapi-example.

sagilar avatar sagilar commented on August 11, 2024

After several attempts, I realized that I had to add the ^^xsd:string for every data property assertion that involved a string parameter. Now the SWRL rules and SQWRL queries are working again.

  • This was done using the 5.2 version of Protégé. The 5.5 is presenting the bug as stated in the Protégé mailing list thread.

Thanks for your help.

from swrlapi-example.

Related Issues (2)

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.