0

I have several questions on OWL + SWRL. Please note that I am a newbie either on all the science behind logics and ontologies. And newbie on protégé as well. I am currently using Protégé 5.6.1. I have an ontology where I model assemblies composed of parts. Thus I have a sort of tree structure, using a Transitive object property called hasPart. And the inverse property is isPartOf.

I attach a minimalistic ontology to explain my problem. You can download it here

I have created individuals and asserted properties such as :

assembly_1 hasPart part_01.
part_01 hasPart part_02.

and a more complex example :

assembly_2 hasPart part_10.
assembly_2 hasPart part_20.
assembly_2 hasPart part_30.

part_10 hasPart part_11.
part_30 hasPart part_31.
part_31 hasPart part_32.

Each part has a data property massKg. Except for part_31

Starting Pellet reasonner, the transitive property behaves properly IMHO. For instance, with assertion and inference, assembly_2 has all parts >= part_10. And part_32 is part of part_31 and part_30 and assembly_2.

But now, that is where I am stucked...

I would like to know, with a SWRL (from my understanding), that a part is a leaf of the assembly tree. I was keen to code something like :

isPartOf(?object, ?parent) ^ not( hasPart(?object, ?noSubPart)) -> isLeaf(?object, true)

That is to say : "an object which is part of a parent object, but has no sub part, is a leaf". Saddly, negation seems not supported on object properties (looking at this FAQ).

How can I do ?

Similar question would be on data properties. For instance, how can I create a SWRL rule base on the condition that the individual has no data property massKg ?

Finally, I would like to create a rule / a way (maybe a SQWRL ? ) to get the total massKg of an assembly. Either because this is the top most element of the tree. Or (because I will have this case in the future), because the individual is of a given class, and I want the sum of all parts that are part of it.

I am open to proposals. And open to openmindness. Because I am new to OWL and SWRL, and currently have not capitalized a lot. So I am even OK (and I would be happy to have your thoughts) if you propose me other ways to compute rules (forward and backward) and maths on ontologies or knowledge base / triplestores / whatever.

Do not hesitate to propose me websites / articles / books to improve myself.

Thanks in advance. Boris

B.Bocquet
  • 21
  • 5
  • besides the unallowed property negation: the problem with your SWRL rule is that in OWL semantics, and thus also in SWRL, there holds the *Open World Assumption* - that means, absence of an information doesn't mean the information doesn't hold. That means, you can't ask for `not( hasPart(?object, ?noSubPart))` - that would only possible if you "close" the world which is often even impossible, and mostly annoying. For those kind of queries something from other directions like SPARQL or SHACL would be more appropriate. But you would have to integrate it somehow in your workflow – UninformedUser Mar 29 '23 at 05:50
  • Regarding your second question: that means only the sum of the direct parts of an assembly, right? Because I assume each part has as mass the sum of all it's subparts, right? – UninformedUser Mar 29 '23 at 05:56
  • Hm, ok - your data says "no" - part_10 is 10kg and has part part_11, which itself is 11kg . So the weight is always without its parts, right? – UninformedUser Mar 29 '23 at 06:02
  • 1
    you can try this SQWRL query and let me know if this is what you want: `PhysicalObject(?o) ^ hasPart(?o, ?p) ^ massKg(?p, ?m) ^ sqwrl:makeBag(?b, ?m) ^ sqwrl:groupBy(?b, ?o) ^ sqwrl:sum(?sum, ?b) -> sqwrl:select(?o, ?sum)` – UninformedUser Mar 29 '23 at 06:12
  • Dear UninformedUser, your SQWRL works as I was expecting. Thank you. Now, how can I apply the rule to fill the data property `totalMassKg` ? I was expecting this to work `PhysicalObject(?o) ^ hasPart(?o, ?p) ^ massKg(?p, ?m) ^ sqwrl:makeBag(?b, ?m) ^ sqwrl:groupBy(?b, ?o) ^ sqwrl:sum(?sum, ?b) -> totalMassKg(?o, ?sum)` . But this does not. – B.Bocquet Mar 29 '23 at 06:55
  • So has anyone an idea ? I've looked on the internet, and asked a friend from a lab : it looks like non-feasible. Any help is welcome, otherwise I will have to switch to another technology – B.Bocquet Apr 05 '23 at 06:51

0 Answers0