1

I'm new to protege and ontologies. I wrote this rule in SQWRL tab in protege, to figure out if p is managed by r:

metadata(?md1) ^ hasValue(?md1, ?val) ^ hasLabel(?md1, ?lbl) ^ replicaset(?r) ^ hasMatchlabels(?r, ?md1)  .  sqwrl:makeSet(?sr, ?md1) ^
metadata(?md2) ^ pod(?p) ^ hasMetadata(?p, ?md2) ^ hasValue(?md2, ?val) ^ hasLabel(?md2, ?lbl) ^ sqwrl:makeSet(?sp, ?md1) ^ sqwrl:groupBy(?sp, ?p)  .  
sqwrl:difference(?s, ?sr, ?sp) ^ sqwrl:isEmpty(?s) -> isManagedBy(?p, ?r)
  • First line creates a set of r's matchlabels
  • second line if p has labels that have same values as the matchlabels, those matchlabels are put in another set and grouped by p.
  • third line checks if difference between the two sets is empty. If yes, it infers that p is Managed by r.

If I change the left part to -> sqwrl:select(?p,?r) it displays the correct (p,r) couple, but if I change the result to -> isManagedBy(?p,?r) the reasoner(Pellet) doesn't apply that inference. I'm new to protege and sqwrl so I'm not sure what it is that I'm doing wrong?? Can the reasoner not apply sqwrl rules if they use set operations?

Edit: figured out that I made a confusion between sqwrl and swrl. swrl is for creating inference rules and sqwrl is for querying. So sqwrl can't be used to add inference rules. That said, I haven't figured out how to model the relationship I have here.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
RabbitG
  • 103
  • 1
  • 8
  • `SQWRL` is **not** `SWRL` - SQWRL is just an extension resp. a query language for SWRL only available via Protege (or the SQWRL Java API). Pellet indeed doesn't know those custom functions predicates like `makeSet`, `difference` etc from `sqwrl:` namespace – UninformedUser Sep 22 '22 at 06:04
  • And you can't model what you want in SWRL - reasoning is monotonic and won't cover aggregates or sets functions like you need. You should think about something beyond SWRL, e.g. SPARQL or something on the client side even beyond – UninformedUser Sep 22 '22 at 06:06

0 Answers0