0

I have an ontology wishing Protege and now I would like to implement rules.

I have an individual that has a literal PANEL = "R1-2B". I like to formulate a rule that if this value is "R1-2" then this individual has the object property "isGiveWaySign".

I have tried some things, but I SWRL does is not like supposed. I get just man new classes instead of setting just an object property.

My approaches look like:

PANEL(?a, ?b) ^ swrlb:substring(?b, "R1-2") -> isGiveWaySign(?a)

did I miss something?

mixi
  • 19
  • 2
  • an unary predicate denotes a class in OWL...properties in OWL are always binary predicates. if `isGiveWaySign` is supposed to be a property, then you should add a value for it, e.g. `"true"^^xsd:boolean` or whatever - I don't know your ontology. – UninformedUser Aug 22 '18 at 06:23
  • This is a screenshot to my current ontology ![Valid XHTML](http://pizza-wagen.de/web19/ontology.png). – mixi Aug 22 '18 at 07:07
  • I have three instances in the class 'SignsRegulatory'. One is e.g. Sign_GiveWay_6411546. This individual has PANEL_01_DESIGN as value 'R1-2B'. I would like to have s rule that read this value, and then move this individual to the class :GiveWaySign (likely by setting the object property 'isGiveWaySign') . This things that I tried are not working – mixi Aug 22 '18 at 07:14

2 Answers2

1

correction to the solution above that worked for me better:

Panel(?s, ?gws) ^ swrlb:contains(?gws, "R1-2") ^ Sign(?s) -> GiveWaySign(?s)

mixi
  • 19
  • 2
0

I figured it out using the excellent blood pressure example here at stack overflow. I have simplified my ontology and could determine the solution for my problem:

Panel(?s, ?gws) ^ swrlb:contains(?gws, "R1-2") ^ Sign(?bs) -> GiveWaySign(?bs)

mixi
  • 19
  • 2
  • right. you should explain that `swrlb:contains` checks for string containment compared to `swrlb:substring` which extracts a string. by the way, you're still "producing" class assertions and not property assertions. – UninformedUser Aug 22 '18 at 09:25
  • and please, don't forget to "accept" your own answer such that it will be marked as "solved" – UninformedUser Aug 22 '18 at 09:27
  • Thanks!. However, there is still a strange behavior, If I run within the SWRL tab in Protege OWL SWRL -> Drools, run Drools and Drools again, then I get many new classes... – mixi Aug 22 '18 at 09:42