protegeproject / swrlapi

Java API for working with the SWRL rule and SQWRL query languages
Other
99 stars 40 forks source link

drools cannot convert value of type rdf:PlainLiteral to xsd:string #50

Closed KoenigLear closed 5 years ago

KoenigLear commented 5 years ago

When creating a SWRL rule:

:dataProperty1(?a, ?v) ^ swrlb:contains(?v, "Lorem ipsum"^^xsd:string) -> :TestData(?a)

where

:dataProperty1 rdfs:range xsd:string .

the drools converter fails with:

[Error: invoker.invoke("Test", "swrlb:contains", 0, false, new VPATH(), new BAVNs("v", ""), $v, new L("Lorem ipsum", "xsd:string")): built-in exception thrown by built-in swrlb:contains in rule Test: exception thrown by built-in swrlb:contains in rule Test: cannot convert value of type rdf:PlainLiteral to xsd:string]

note: using the Pellet reasoner (no DROOLS) the rule works fine.

martinjoconnor commented 5 years ago

Can you post the OWL ontology that defines dataProperty1. (You will need to add .txt to the file name because GtiHub does not accept .owl extensions.)

KoenigLear commented 5 years ago

Thanks for your quick reply @martinjoconnor . See below for the ontology files:

test.txt testError.txt

As it turns out the issue is that I have some data that where an individual's property value is not explicitly set to xsd:string which causes the error. Pellet online reasoner was much forgiving in this sense but it's thus not strictly an issue. Happy to close.

martinjoconnor commented 5 years ago

Great.

FYI, the Protege mailing list may also be a useful resource for future questions:

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