#Below are SPARQL update operations that further define some of the types
#  declared or defined in the Turtle file displayed by
#  http://www.webkb.org/kb/it/p_kEvaluation/ontology/sub/sub.ttl.html
#  Since this referred Turtle file uses types that are further defined below,
#    the parsing of the Turtle file shouldbe followed by the execution of the 
#    SPARQL update operations below.

#This file reuses the sections of Sections 1 of the Turtle file 
#  (in order to ease the reader's comparison between the two files)
#  and sub-divides some of them. The symmetry between the divisions of 
#  Section 1.2.1 and those of Section 1.3.1 is intensional.
#  Here is the Table of Content :
# 1. Basic Types
# 1.1. Some Top-Level Basic Relation Types  //empty in this file
# 1.2. Generalization, Specialization, Comparability And Definitions
#      1.2.1. Strict Generalization And Specialization
#             1.2.1.1. sub:sC (strict subClass uncomparable but not disjoint to its siblings
#                              except for those which are  connected by disjointWith relations)
#             1.2.1.2. sub:sP (counterpart of sub:SC for properties)
#             1.2.1.3. sub:pP (partition of properties)
#             1.2.1.4. sub:eC (sub:exclusive_strict_subClasses), sub:eP (idem but for properties)
#             1.2.1.5. sub:uoP (union of properties) and sub:cP (as sub:cC but for properties) 
#             1.2.1.6. sub:neCs (non-equivalent nor exclusive classes), nePs
# 1.3. Parts, Members and Their Inverses
#      1.3.1. Strict Parts/Members and Their Inverses
#             1.3.1.1. sub:sPart, counterpart of sC and sP for parts (from individuals)
#             1.3.1.2. sub:c_partOf, sub:c_part, sub:c_sPart
#                      (counterparts of sub:partOf, sub:part and sub:sPart, but from types)
#             1.3.1.3. sub:pParts, sub:c_pParts (part partitions for individuals/types)
#             1.3.1.4. sub:eParts, sub:c_eParts
#             1.3.1.5. sub:cParts, sub:c_cParts
# 1.4. Contextualizing Or Negating Relations



#The order of the SPARQL update operations below is important:
#  if an operation reuses another (hence expands into another),
#  it must be placed before it to be executed before it.


BASE         <http://www.webkb.org/kb/it/p_kEvaluation/ontology/sub/> 
PREFIX  sub: <http://www.webkb.org/kb/it/p_kEvaluation/ontology/sub/> .
PREFIX  rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
PREFIX  owl: <http://www.w3.org/2006/12/owl2#> .
PREFIX  xsd: <http://www.w3.org/2001/XMLSchema#> .




#@@@@@@@@@@@@@@@@@@@@@@@@ 1. Basic Types


#*********************** 1.1. Some Top-Level Basic Relation Types



#************************ 1.2. Generalization, Specialization, Comparability And Definitions

#======================== 1.2.1. Strict Generalization And Specialization

#------------------------ 1.2.1.1. sub:sC (strict subClass uncomparable but not disjoint to its
#                      siblings except for those which are  connected by disjointWith relations)
#  cf. http://www.webkb.org/kb/it/o_KR/p_kEvaluation/o_completeness/#SomeUsefulSubtypeProperties

#First, sub:sC_ (since it is given in the article)
DELETE { ?class sub:sC_ ?subC1, ?subC2 } 
 INSERT{ ?class sub:proper-superClassOf ?subC1, ?subC2 .
         ?subC1 sub:uncomparable-but-not-disjoint_class ?subC2 } 
 WHERE { ?class sub:sC_ ?subC1, ?subC2 .  #for any two subclasses ?subC1 and ?subC2
         FILTER(?subC1 != ?subC2)  };


#Now, sub:sC
#1) the case that implies sub:sC (i.e. when ?subC1 is not comparable/exclusive to ?subC2):
DELETE { ?class sub:sC ?subC1, ?subC2 } 
 INSERT{ ?class sub:proper-superClassOf ?subC1, ?subC2 .
         ?subC1 sub:uncomparable-but-not-disjoint_class ?subC2 } 
 WHERE { ?class sub:sC ?subC1, ?subC2 .  #for any two subclasses ?subC1 and ?subC2
         FILTER(?subC1 != ?subC2) 
         FILTER NOT EXISTS{ ?subC1 rdfs:subClassOf|owl:equivalentClass|owl:sameAs ?subC2 }
         FILTER NOT EXISTS{ ?subC1 ^rdfs:subClassOf|owl:disjointWith ?subC2 }
       };
#2) the case where ?subC1 is comparable to ?subC2:
DELETE { ?class sub:sC ?subC1, ?subC2 } 
 INSERT{ ?class sub:proper-superClassOf ?subC1, ?subC2 }
 WHERE { ?class sub:sC ?subC1, ?subC2 .  #for any two subclasses ?subC1 and ?subC2
         FILTER(?subC1 != ?subC2) 
         FILTER EXISTS{ ?subC1 
                  rdfs:subClassOf|^rdfs:subClassOf|owl:equivalentClass|owl:sameAs ?subC2 }
       };
#3) the case where ?subC1 is exclusive to ?subC2:
DELETE { ?class sub:sC ?subC1, ?subC2 } 
 INSERT{ ?class sub:proper-superClassOf ?subC1, ?subC2 }
 WHERE { ?class sub:sC ?subC1, ?subC2 .  #for any two subclasses ?subC1 and ?subC2
         FILTER EXISTS{ ?subC1 owl:disjointWith ?subC2 }
       };


#------------------------ 1.2.1.2. sub:sP (counterpart of sub:SC for properties)

#1) the case that implies sub:sP (i.e. when ?subP1 is not comparable/exclusive to ?subP2):
DELETE { ?prop sub:sP ?subP1, ?subP2 } 
 INSERT{ ?prop sub:proper-superPropertyOf ?subP1, ?subP2 .
         ?subP1 sub:uncomparable-but-not-disjoint_pr ?subP2 } 
 WHERE { ?prop sub:sP ?subP1, ?subP2 .  #for any two subproperties ?subP1 and ?subP2
         FILTER(?subP1 != ?subP2) 
         FILTER NOT EXISTS{ ?subP1 rdfs:subPropertyOf|owl:equivalentProperty|owl:sameAs ?subP2 }
         FILTER NOT EXISTS{ ?subP1 ^rdfs:subPrOf|owl:disjointProperty ?subP2 }
       };
#2) the case where ?subP1 is comparable to ?subP2:
DELETE { ?prop sub:sP ?subP1, ?subP2 } 
 INSERT{ ?prop sub:proper-superPropertyOf ?subP1, ?subP2 }
 WHERE { ?prop sub:sP ?subP1, ?subP2 .  #for any two subproperties ?subP1 and ?subP2
         FILTER(?subP1 != ?subP2) 
         FILTER EXISTS{ ?subP1
              rdfs:subPropertyOf|^rdfs:subPropertyOf|owl:equivalentProperty|owl:sameAs ?subP2 }
       };
#3) the case where ?subP1 is exclusive to ?subP2:
DELETE { ?prop sub:sP ?subP1, ?subP2 } 
 INSERT{ ?prop sub:proper-superPropertyOf ?subP1, ?subP2 }
 WHERE { ?prop sub:sP ?subP1, ?subP2 .  #for any two subproperties ?subP1 and ?subP2
         FILTER EXISTS{ ?subP1 owl:disjointProperty ?subP2 }
       };


#------------------------ 1.2.1.3. sub:pP (partition of properties: disjointUnionOfProperties); 
#                                         counterpart of sub:pC (owl:unionDisjointOf)

DELETE { ?prop sub:pP (?p1 ?p2) } 
 INSERT{ ?prop sub:eP (?p1 ?p2).  ?prop sub:cP (?p1 ?p2). }
 WHERE {#?prop sub:pP (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?prop sub:pP [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?prop sub:pP (?p1 ?p2 ?p3) } 
 INSERT{ ?prop sub:eP (?p1 ?p2 ?p3).  ?prop sub:cP (?p1 ?p2 ?p3). }
 WHERE {#?prop sub:pP (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?prop sub:pP [a rdf:List; rdf:first ?p1; 
                                   rdf:rest [a rdf:List; rdf:first ?p2;
                                                         rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?prop sub:pP (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:eP (?p1 ?p2 ?p3 ?p4).  ?prop sub:cP (?p1 ?p2 ?p3 ?p4). }
 WHERE {#?prop sub:pP (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:pP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                                         rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?prop sub:pP (?p1 ?p2 ?p3 ?p4 ?p5)  } 
 INSERT{ ?prop sub:eP (?p1 ?p2 ?p3 ?p4 ?p5).  ?prop sub:cP (?p1 ?p2 ?p3 ?p4 ?p5). }
 WHERE {#?prop sub:pP (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?prop sub:pP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};


#------------------------ 1.2.1.4. sub:eC (sub:#exclusive_strict_subClasses),
#                                  sub:eP (sub:exclusive_strict_subProperties; sub:eC counterpart)  

#note: here, sub:eC and sub:eP are not explicitly defined as "incomplete"
#      since this precision would not support additional inference possibilities


DELETE { ?class sub:eC (?p1 ?p2) } 
 INSERT{ ?class sub:strict_subClass ?p1, ?p2.
         [] rdf:type owl:AllDisjointClasses; owl:members (?p1 ?p2) } 
 WHERE {#?class sub:eC (?p1 ?p2)  #intuitive but incorrect with SPARQL
       };
DELETE { ?class sub:eC (?p1 ?p2 ?p3) } 
 INSERT{ ?class sub:strict_subClass ?p1, ?p2, ?p3.
         [] rdf:type owl:AllDisjointClasses; owl:members (?p1 ?p2 ?p3) } 
 WHERE {#?class sub:eC (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?class sub:eC [a rdf:List; rdf:first ?p1; 
                                    rdf:rest [a rdf:List; rdf:first ?p2;
                                                          rdf:rest [a rdf:List; rdf:first ?p3] ]]};
DELETE { ?class sub:eC (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?class sub:strict_subClass ?p1, ?p2, ?p3, ?p4.
         [] rdf:type owl:AllDisjointClasses; owl:members (?p1 ?p2 ?p3 ?p4) } 
 WHERE {#?class sub:eC (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?class sub:eC [a rdf:List; rdf:first ?p1; 
                         rdf:rest [a rdf:List; rdf:first ?p2;
                                    rdf:rest [a rdf:List; rdf:first ?p3;
                                                          rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?class sub:eC (?p1 ?p2 ?p3 ?p4 ?p5) } 
 INSERT{ ?class sub:strict_subClass ?p1, ?p2, ?p3, ?p4, ?p5.
         [] rdf:type owl:AllDisjointClasses; owl:members (?p1 ?p2 ?p3 ?p4 ?p5) } 
 WHERE {#?class sub:eC (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?class sub:eC [a rdf:List; rdf:first ?p1; 
                         rdf:rest [a rdf:List; rdf:first ?p2;
                                    rdf:rest [a rdf:List; rdf:first ?p3;
                                               rdf:rest [a rdf:List; rdf:first ?p4;
                                                          rdf:rest [a rdf:List; rdf:first ?p5]]]]]};



DELETE { ?prop sub:eP (?p1 ?p2) } 
 INSERT{ ?prop sub:strict_subProperty ?p1, ?p2.  ?p1 owl:propertyDisjointWith ?p2 }
 WHERE {#?prop sub:eP (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?prop sub:eP [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?prop sub:eP (?p1 ?p2 ?p3) } 
 INSERT{ ?prop sub:strict_subProperty ?p1, ?p2, ?p3.
         ?p1 owl:propertyDisjointWith ?p2, ?p3.  ?p2 owl:propertyDisjointWith ?p3 }
 WHERE {#?prop sub:eP (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?prop sub:eP [a rdf:List; rdf:first ?p1; 
                                   rdf:rest [a rdf:List; rdf:first ?p2;
                                                         rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?prop sub:eP (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:strict_subProperty ?p1, ?p2, ?p3, ?p4.
         ?p1 owl:propertyDisjointWith ?p2, ?p3, ?p4.
         ?p2 owl:propertyDisjointWith ?p3, ?p4. ?p3 owl:propertyDisjointWith ?p4 }
 WHERE {#?prop sub:eP (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:eP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                                         rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?prop sub:eP (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:strict_subProperty ?p1, ?p2, ?p3, ?p4, ?p5.
         ?p1 owl:propertyDisjointWith ?p2, ?p3, ?p4, ?p5.
         ?p2 owl:propertyDisjointWith ?p3, ?p4, ?p5.
         ?p3 owl:propertyDisjointWith ?p4, ?p5.
         ?p4 owl:propertyDisjointWith ?p5 }
 WHERE {#?prop sub:eP (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:eP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};


#------------------------ 1.2.1.5. sub:uoP (union of properties) and sub:cP;
#                                  counterparts of sub:uoC (owl:unionOf) and sub:cC for properties

DELETE { ?p sub:cP (?p1 ?p2)  }
 INSERT{ ?p sub:uoP (?p1 ?p2).   ?p1 sub:ne ?p2. }
 WHERE {#?p sub:cP (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?p sub:cP [a rdf:List; rdf:first ?subI1; 
                                rdf:rest [a rdf:List; rdf:first ?p2;
                                                      rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?p sub:cP (?p1 ?p2 ?p3)  }
 INSERT{ ?p sub:uoP (?p1 ?p2 ?p3).   ?p2 sub:nePs (?p1 ?p2 ?p3). }
 WHERE {#?p sub:cP (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?p sub:cP [a rdf:List; rdf:first ?subI1; 
                                rdf:rest [a rdf:List; rdf:first ?p2;
                                                      rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?p sub:cP (?p1 ?p2 ?p3 ?p4)  }
 INSERT{ ?p sub:uoP (?p1 ?p2 ?p3 ?p4).   ?p2 sub:nePs (?p1 ?p2 ?p3 ?p4). }
 WHERE {#?p sub:cP (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?p sub:cP [a rdf:List; rdf:first ?subI1; 
                     rdf:rest [a rdf:List; rdf:first ?p2;
                                rdf:rest [a rdf:List; rdf:first ?p3;
                                                      rdf:rest [a rdf:List; rdf:first ?p4] ] ] ] };
DELETE { ?p sub:cP (?p1 ?p2 ?p3 ?p4 ?p5)  }
 INSERT{ ?p sub:uoP (?p1 ?p2 ?p3 ?p4 ?p5).   ?p2 sub:nePs (?p1 ?p2 ?p3 ?p4 ?p5). }
 WHERE {#?p sub:cP (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?prop sub:cP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};



DELETE { ?p sub:uoP (?p1 ?p2 ?p3 ?p4 ?p5)  }
 INSERT{ ?p2345 sub:uoP (?p2 ?p3 ?p4 ?p5).  ?p sub:uoP (?p1 ?p2345)  }
 WHERE {#?p sub:uoP (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?prop sub:uoP [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};
DELETE { ?p sub:uoP (?p1 ?p2 ?p3 ?p4)  }
 INSERT{ ?p234 sub:uoP (?p2 ?p3 ?p4).       ?p sub:uoP (?p1 ?p234)   }
 WHERE {#?p sub:uoP (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?p sub:uoP [a rdf:List; rdf:first ?subI1; 
                     rdf:rest [a rdf:List; rdf:first ?p2;
                                rdf:rest [a rdf:List; rdf:first ?p3;
                                                      rdf:rest [a rdf:List; rdf:first ?p4] ] ] ] };
DELETE { ?p sub:uoP (?p1 ?p2 ?p3)  }
 INSERT{ ?p23 sub:uoP (?p2 ?p3).            ?p sub:uoP (?p1 ?p23)    }
 WHERE {#?p sub:uoP (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?p sub:uoP [a rdf:List; rdf:first ?subI1; 
                                 rdf:rest [a rdf:List; rdf:first ?p2;
                                                       rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?p sub:uoP (?p1 ?p2)  }
 INSERT{
  ?p1 rdfs:subPropertyOf ?p .    ?p2 rdfs:subPropertyOf ?p .
  ?p rdfs:domain [a owl:Class;  owl:equivalentClass [owl:unionOf
          ( [a owl:Restriction; owl:onProperty ?p1; owl:minCardinality 1] #1. -(p1D.!p2D, ?p1R.p2R)
            [a owl:Restriction; owl:onProperty ?p2; owl:minCardinality 1] #2. -(!p1D.p2D,  p1R.?p2R)
          ) ] ];
     rdfs:range [a owl:Class;  owl:equivalentClass [owl:unionOf
         ( [a owl:Restriction; owl:onProperty [owl:inverseOf ?p1]; owl:minCardinality 1]
           [a owl:Restriction; owl:onProperty [owl:inverseOf ?p2]; owl:minCardinality 1]
         ) ] ].

  ?p owl:disjointWith     #remove  a p b s.t. a p1 _ _ p2 b      #1. -(p1D.!p2D, ?p1R.p2R)
       [rdfs:domain       #           "without triplets having a subject of p1 and an object of p2"
          [owl:intersectionOf
             ( [a owl:Restriction; owl:onProperty ?p1; owl:minCardinality 1]
               [a owl:Restriction; owl:onProperty ?p2; owl:cardinality 0]
             ) ];
        rdfs:range
          [owl:intersectionOf
            ( [a owl:Restriction; owl:onProperty [owl:inverseOf ?p1]; owl:cardinality 0]
              [a owl:Restriction; owl:onProperty [owl:inverseOf ?p2]; owl:minCardinality 1]
            ) ]
       ].
  ?p owl:disjointWith     #remove a p b s.t.  a p2 _ _ p1 b      #2. -(!p1D.p2D, p1R.?p2R)
       [rdfs:domain       #          "without triplets having a subject of p2 and an object of p1"
          [owl:intersectionOf
             ( [a owl:Restriction; owl:onProperty ?p1; owl:cardinality 0]
               [a owl:Restriction; owl:onProperty ?p2; owl:minCardinality 1]
             ) ];
        rdfs:range
          [owl:intersectionOf
            ( [a owl:Restriction; owl:onProperty [owl:inverseOf ?p1]; owl:minCardinality 1]
              [a owl:Restriction; owl:onProperty [owl:inverseOf ?p2]; owl:cardinality 0]
            ) ]
       ]
 }
 WHERE {#?p sub:uoP (?p1 ?p2)   #intuitive but incorrect with SPARQL
         ?p sub:uoP [a rdf:List; rdf:first ?p1; rdf:rest [a rdf:List; rdf:first ?p] ]
       };


#------------------------ 1.2.1.6. sub:neCs (non-equivalent nor exclusive classes), nePs

DELETE { ?prop sub:neCs (?p1 ?p2) } 
 INSERT{ ?prop sub:neC ?p1, ?p2.   ?p1 sub:neC ?p2. }
 WHERE {#?prop sub:neCs (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?prop sub:neCs [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?prop sub:neCs (?p1 ?p2 ?p3) } 
 INSERT{ ?prop sub:neC ?p1, ?p2, ?p3.   ?p1 sub:neC ?p2, ?p3.  ?p2 sub:neC ?p3 }
 WHERE {#?prop sub:neCs (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?prop sub:neCs [a rdf:List; rdf:first ?p1; 
                                   rdf:rest [a rdf:List; rdf:first ?p2;
                                                         rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?prop sub:neCs (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:neCs ?p1, ?p2, ?p3, ?p4.  ?p1 sub:neC ?p2, ?p3, ?p4.
                                             ?p2 sub:neC ?p3, ?p4.      ?p3 sub:neC ?p4 }
 WHERE {#?prop sub:neCs (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:neCs [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                                         rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?prop sub:neCs (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:neCs ?p1, ?p2, ?p3, ?p4, ?p5.    ?p1 sub:neC ?p2, ?p3, ?p4, ?p5.
         ?p2 sub:neC ?p3, ?p4, ?p5.   ?p3 sub:neC ?p4, ?p5.     ?p4 sub:neC ?p5 }
 WHERE {#?prop sub:neCs (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:neCs [a rdf:List; rdf:first ?p1; 
                         rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};


DELETE { ?prop sub:nePs (?p1 ?p2) } 
 INSERT{ ?prop sub:neP ?p1, ?p2.   ?p1 sub:neP ?p2. }
 WHERE {#?prop sub:nePs (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?prop sub:nePs [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?prop sub:nePs (?p1 ?p2 ?p3) } 
 INSERT{ ?prop sub:neP ?p1, ?p2, ?p3.   ?p1 sub:neP ?p2, ?p3.  ?p2 sub:neP ?p3 }
 WHERE {#?prop sub:nePs (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?prop sub:nePs [a rdf:List; rdf:first ?p1; 
                                   rdf:rest [a rdf:List; rdf:first ?p2;
                                                         rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?prop sub:nePs (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:nePs ?p1, ?p2, ?p3, ?p4.  ?p1 sub:neP ?p2, ?p3, ?p4.
                                             ?p2 sub:neP ?p3, ?p4.      ?p3 sub:neP ?p4 }
 WHERE {#?prop sub:nePs (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:nePs [a rdf:List; rdf:first ?p1; 
                        rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                                         rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?prop sub:nePs (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?prop sub:nePs ?p1, ?p2, ?p3, ?p4, ?p5.    ?p1 sub:neP ?p2, ?p3, ?p4, ?p5.
         ?p2 sub:neP ?p3, ?p4, ?p5.   ?p3 sub:neP ?p4, ?p5.     ?p4 sub:neP ?p5 }
 WHERE {#?prop sub:nePs (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?prop sub:nePs [a rdf:List; rdf:first ?p1; 
                         rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};







#************************ 1.3. Parts, Members and Their Inverses

#======================== 1.3.1. Strict Parts/Members and Their Inverses
#  cf. http://www.webkb.org/kb/it/o_KR/p_kEvaluation/o_completeness/#ViaPart

#------------------------ 1.3.1.1. sub:sPart, counterpart of sC and sP for parts (from individuals)

#1) the case that implies sub:part (i.e. when ?part1 is not part-comparable/exclusive to ?part2):
DELETE { ?indiv sub:sPart ?part1, ?part2 } 
 INSERT{ ?indiv sub:part ?part1, ?part2 .
         ?part1 sub:part-uncomparable_but_not_part-exclusive ?part2 } 
 WHERE { ?indiv sub:sPart ?part1, ?part2 .  #for any two parts ?part1 and ?part2
         FILTER(?part1 != ?part2) 
         FILTER NOT EXISTS{ ?part1 sub:part_or_equivalent|owl:sameAs ?part2 }
         FILTER NOT EXISTS{ ?part1 ^sub:part_or_equivalent|sub:part_exclusion ?part2 }
       };
#2) the case where ?part1 is part-comparable to ?part2:
DELETE { ?indiv sub:sPart ?part1, ?part2 } 
 INSERT{ ?indiv sub:part ?part1, ?part2 }
 WHERE { ?indiv sub:sPart ?part1, ?part2 .  #for any two subclasses ?part1 and ?part2
         FILTER(?part1 != ?part2) 
         FILTER EXISTS{ ?part1 sub:part_or_equivalent|sub:partOf|owl:sameAs ?part2 }
       };
#3) the case where ?part1 is part-exclusive to ?part2:
DELETE { ?indiv sub:sPart ?part1, ?part2 } 
 INSERT{ ?indiv sub:part ?part1, ?part2 }
 WHERE { ?indiv sub:sPart ?part1, ?part2 .  #for any two subclasses ?part1 and ?part2
         FILTER EXISTS{ ?part1 sub:part_exclusion ?part2 }
       };


#------------------------ 1.3.1.2. sub:c_partOf, sub:c_part, sub:c_sPart
#                                  (counterparts of sub:partOf, sub:part and sub:sPart, from types)

DELETE { ?class sub:c_partOf ?superpartClass } 
 INSERT{ ?class rdf:type rdfs:Class;
         rdfs:subClassOf [rdf:type owl:Restriction;  owl:onProperty sub:partOf;
                          owl:allValuesFrom ?superpartClass]. } 
 WHERE { ?class sub:c_partOf ?superpartClass };


DELETE { ?class sub:c_part ?subpartClass } 
 INSERT{ ?class rdf:type rdfs:Class; 
                rdfs:subClassOf [rdf:type owl:Restriction;  owl:onProperty sub:part;
                                 owl:allValuesFrom ?subpartClass]. } 
 WHERE { ?class sub:c_part ?subpartClass };


#1) the case that implies sub:c_part: when ?c_part1 is not c_part-comparable/disjoint to ?c_part2
DELETE { ?class sub:c_sPart ?c_part1, ?c_part2 } 
 INSERT{ ?class sub:c_part ?c_part1, ?c_part2 .
         ?c_part1 sub:c_part-uncomparable_but_not_part-disjoint ?c_part2 } 
 WHERE { ?class sub:c_sPart ?c_part1, ?c_part2 .  #for any two parts ?c_part1 and ?c_part2
         FILTER(?c_part1 != ?c_part2) 
         FILTER NOT EXISTS{ ?c_part1 sub:c_part_or_equivalent|sub:eqC ?c_part2 }
         FILTER NOT EXISTS{ ?c_part1 ^sub:c_part_or_equivalent|sub:c_part_exclusion ?c_part2 }
       };
#2) the case where ?c_part1 is part-comparable to ?c_part2:
DELETE { ?class sub:c_sPart ?c_part1, ?c_part2 } 
 INSERT{ ?class sub:c_part ?c_part1, ?c_part2 }
 WHERE { ?class sub:c_sPart ?c_part1, ?c_part2 .  #for any two subclasses ?c_part1 and ?c_part2
         FILTER(?c_part1 != ?c_part2) 
         FILTER EXISTS{ ?c_part1 sub:c_part_or_equivalent|sub:c_partOf|sub:eqC ?c_part2 }
       };
#3) the case where ?c_part1 is part-exclusive to ?c_part2:
DELETE { ?class sub:c_sPart ?c_part1, ?c_part2 } 
 INSERT{ ?class sub:c_part ?c_part1, ?c_part2 }
 WHERE { ?class sub:c_sPart ?c_part1, ?c_part2 .  #for any two subclasses ?c_part1 and ?c_part2
         FILTER EXISTS{ ?c_part1 sub:c_part_exclusion ?c_part2 }
       };



#------------------------ 1.3.1.3. sub:pParts, sub:c_pParts (part partitions for individuals/types)
#                                  counterpart of sub:pC and sub:pP for parts

DELETE { ?indiv sub:pParts ( ?p1 ?p2 ) }
 INSERT{ ?indiv sub:eParts ( ?p1 ?p2 ) .  ?indiv sub:cParts ( ?p1 ?p2 ). }
 WHERE {#?indiv sub:pParts ( ?p1 ?p2 )  #intuitive but incorrect with SPARQL
         ?indiv sub:parts [a rdf:List; rdf:first ?p1; rdf:rest [a rdf:List; rdf:first ?p2]].
       };
DELETE { ?indiv sub:pParts (?p1 ?p2 ?p3) } 
 INSERT{ ?indiv sub:eParts (?p1 ?p2 ?p3).  ?indiv sub:cParts (?p1 ?p2 ?p3). }
 WHERE {#?indiv sub:pParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?indiv sub:pParts [a rdf:List; rdf:first ?p1; 
                            rdf:rest [a rdf:List; rdf:first ?p2;
                                                  rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?indiv sub:pParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?indiv sub:eParts (?p1 ?p2 ?p3 ?p4).  ?indiv sub:cParts (?p1 ?p2 ?p3 ?p4). }
 WHERE {#?indiv sub:pParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?indiv sub:pParts [a rdf:List; rdf:first ?p1; 
                            rdf:rest [a rdf:List; rdf:first ?p2;
                                   rdf:rest [a rdf:List; rdf:first ?p3;
                                                         rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?indiv sub:pParts (?p1 ?p2 ?p3 ?p4 ?p5)  } 
 INSERT{ ?indiv sub:eParts (?p1 ?p2 ?p3 ?p4 ?p5).  ?indiv sub:cParts (?p1 ?p2 ?p3 ?p4 ?p5). }
 WHERE {#?indiv sub:pParts (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?indiv sub:pParts [a rdf:List; rdf:first ?p1; 
                            rdf:rest [a rdf:List; rdf:first ?p2;
                                  rdf:rest [a rdf:List; rdf:first ?p3;
                                              rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};


DELETE { ?class sub:c_pParts ( ?p1 ?p2 ) }
 INSERT{ ?class sub:c_eParts ( ?p1 ?p2 ) .  ?class sub:c_cParts ( ?p1 ?p2 ). }
 WHERE {#?class sub:c_pParts ( ?p1 ?p2 )  #intuitive but incorrect with SPARQL
         ?class sub:c_pPart [a rdf:List; rdf:first ?p1; rdf:rest [a rdf:List; rdf:first ?p2]].
       };
DELETE { ?class sub:c_pParts (?p1 ?p2 ?p3) } 
 INSERT{ ?class sub:c_eParts (?p1 ?p2 ?p3).  ?class sub:c_cParts (?p1 ?p2 ?p3). }
 WHERE {#?class sub:c_pParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?class sub:c_pParts [a rdf:List; rdf:first ?p1; 
                              rdf:rest [a rdf:List; rdf:first ?p2;
                                                    rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?class sub:c_pParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?class sub:c_eParts (?p1 ?p2 ?p3 ?p4).  ?class sub:c_cParts (?p1 ?p2 ?p3 ?p4). }
 WHERE {#?class sub:c_pParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?class sub:c_pParts [a rdf:List; rdf:first ?p1; 
                              rdf:rest [a rdf:List; rdf:first ?p2;
                                        rdf:rest [a rdf:List; rdf:first ?p3;
                                                   rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?class sub:c_pParts (?p1 ?p2 ?p3 ?p4 ?p5)  } 
 INSERT{ ?class sub:c_eParts (?p1 ?p2 ?p3 ?p4 ?p5).  ?class sub:c_cParts (?p1 ?p2 ?p3 ?p4 ?p5). }
 WHERE {#?class sub:c_pParts (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?class sub:c_pParts [a rdf:List; rdf:first ?p1; 
                              rdf:rest[a rdf:List; rdf:first ?p2;
                                       rdf:rest[a rdf:List; rdf:first ?p3;
                                                rdf:rest [a rdf:List; rdf:first ?p4;
                                                          rdf:rest[a rdf:List; rdf:first ?p5] ]]]]};


#------------------------ 1.3.1.4. sub:eParts, sub:c_eParts
#                                  counterpart of sub:eC and sub:eP for parts

#note: here, sub:eParts and sub:c_eParts are not explicitly defined as "incomplete"
#      since this precision would not support additional inference possibilities

DELETE { ?indiv sub:eParts (?p1 ?p2) } 
 INSERT{ ?indiv sub:part ?p1, ?p2.  ?p1 sub:part_exclusion ?p2 }
 WHERE {#?indiv sub:eParts (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?indiv sub:eParts [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?indiv sub:eParts (?p1 ?p2 ?p3) } 
 INSERT{ ?indiv sub:part ?p1, ?p2, ?p3.  ?p1 sub:part_exclusion ?p2, ?p3.
                                         ?p2 sub:part_exclusion ?p3 }
 WHERE {#?indiv sub:eParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?indiv sub:eParts [a rdf:List; rdf:first ?p1; 
                             rdf:rest [a rdf:List; rdf:first ?p2;
                                                   rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?indiv sub:eParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?indiv sub:part ?p1, ?p2, ?p3, ?p4.   ?p1 sub:part_exclusion ?p2, ?p3, ?p4.
         ?p2 sub:part_exclusion ?p3, ?p4.      ?p3 sub:part_exclusion ?p4 }
 WHERE {#?indiv sub:eParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?indiv sub:eParts [a rdf:List; rdf:first ?p1; 
                             rdf:rest [a rdf:List; rdf:first ?p2;
                                        rdf:rest [a rdf:List; rdf:first ?p3;
                                                   rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?indiv sub:eParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?indiv sub:part ?p1, ?p2, ?p3, ?p4, ?p5.
         ?p1 sub:part_exclusion ?p2, ?p3, ?p4, ?p5.   ?p2 sub:part_exclusion ?p3, ?p4, ?p5.
         ?p3 sub:part_exclusion ?p4, ?p5.             ?p4 sub:part_exclusion ?p5 }
 WHERE {#?indiv sub:eParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?indiv sub:eParts [a rdf:List; rdf:first ?p1; 
                            rdf:rest [a rdf:List; rdf:first ?p2;
                                      rdf:rest [a rdf:List; rdf:first ?p3;
                                                rdf:rest [a rdf:List; rdf:first ?p4;
                                                          rdf:rest [a rdf:List; rdf:first ?p5]]]]]};


DELETE { ?class sub:c_eParts (?p1 ?p2) } 
 INSERT{ ?class sub:c_part ?p1, ?p2.  ?p1 sub:c_part_exclusion ?p2 }
 WHERE {#?class sub:c_eParts (?p1 ?p2)  #intuitive but incorrect with SPARQL
         ?class sub:c_eParts [a rdf:List;  rdf:first ?p1;  rdf:rest [a rdf:List; rdf:first ?p2] ]
       };
DELETE { ?class sub:c_eParts (?p1 ?p2 ?p3) } 
 INSERT{ ?class sub:c_part ?p1, ?p2, ?p3.  ?p1 sub:c_part_exclusion ?p2, ?p3. 
                                           ?p2 sub:c_part_exclusion ?p3 }
 WHERE {#?class sub:c_eParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?class sub:c_eParts [a rdf:List; rdf:first ?p1; 
                             rdf:rest [a rdf:List; rdf:first ?p2;
                                                   rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?class sub:c_eParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?class sub:c_part ?p1, ?p2, ?p3, ?p4.   ?p1 sub:c_part_exclusion ?p2, ?p3, ?p4.
         ?p2 sub:c_part_exclusion ?p3, ?p4.      ?p3 sub:c_part_exclusion ?p4 }
 WHERE {#?class sub:c_eParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?class sub:c_eParts [a rdf:List; rdf:first ?p1; 
                             rdf:rest [a rdf:List; rdf:first ?p2;
                                        rdf:rest [a rdf:List; rdf:first ?p3;
                                                   rdf:rest [a rdf:List; rdf:first ?p4] ]]]};
DELETE { ?class sub:c_eParts (?p1 ?p2 ?p3 ?p4) } 
 INSERT{ ?class sub:c_part ?p1, ?p2, ?p3, ?p4, ?p5.
         ?p1 sub:c_part_exclusion ?p2, ?p3, ?p4, ?p5.   ?p2 sub:c_part_exclusion ?p3, ?p4, ?p5.
         ?p3 sub:c_part_exclusion ?p4, ?p5.             ?p4 sub:c_part_exclusion ?p5 }
 WHERE {#?class sub:c_eParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?class sub:c_eParts [a rdf:List; rdf:first ?p1; 
                            rdf:rest [a rdf:List; rdf:first ?p2;
                                      rdf:rest [a rdf:List; rdf:first ?p3;
                                                rdf:rest [a rdf:List; rdf:first ?p4;
                                                          rdf:rest [a rdf:List; rdf:first ?p5]]]]]};


#------------------------ 1.3.1.5. sub:cParts, sub:c_cParts
#                                  counterpart of sub:cC and sub:cP for parts

DELETE { ?p sub:cParts (?p1 ?p2 ?p3 ?p4 ?p5)  }
 INSERT{ ?p2345 sub:cParts (?p2 ?p3 ?p4 ?p5).  ?p sub:cParts (?p1 ?p2345)  }
 WHERE {#?p sub:cParts (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?prop sub:cParts [a rdf:List; rdf:first ?p1; 
                           rdf:rest [a rdf:List; rdf:first ?p2;
                                     rdf:rest [a rdf:List; rdf:first ?p3;
                                               rdf:rest [a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};
DELETE { ?p sub:cParts (?p1 ?p2 ?p3 ?p4)  }
 INSERT{ ?p234 sub:cParts (?p2 ?p3 ?p4).       ?p sub:cParts (?p1 ?p234)   }
 WHERE {#?p sub:cParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?p sub:cParts [a rdf:List; rdf:first ?subI1; 
                     rdf:rest [a rdf:List; rdf:first ?p2;
                                rdf:rest [a rdf:List; rdf:first ?p3;
                                                      rdf:rest [a rdf:List; rdf:first ?p4] ] ] ] };
DELETE { ?p sub:cParts (?p1 ?p2 ?p3)  }
 INSERT{ ?p23 sub:cParts (?p2 ?p3).            ?p sub:cParts (?p1 ?p23)    }
 WHERE {#?p sub:cParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?p sub:cParts [a rdf:List; rdf:first ?subI1; 
                                    rdf:rest [a rdf:List; rdf:first ?p2;
                                               rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?indiv sub:cParts ( ?p1 ?p2 ) }
 INSERT{ ?indiv sub:part ?p1, ?p2 . 
         #any part of ?indiv is also a part of ?p1 or a part of ?p2, 
         #  hence the class for parts of ?indiv is a union of
         #    "the class of the parts of ?p1" and "the class of the parts of ?sub2"
         ?classForSubI1Parts  #the instances of this class are sub:partOf ?p1
            owl:equivalentClass [rdf:type owl:Restriction;  owl:onProperty sub:partOf; 
                                 owl:someValuesFrom ?p1 ] .
         ?classForSubI2Parts  #the instances of this class are sub:partOf ?p2
            owl:equivalentClass [rdf:type owl:Restriction;  owl:onProperty sub:partOf; 
                                 owl:someValuesFrom ?p2 ] .
         ?classForIndivParts
            owl:equivalentClass [rdf:type owl:Restriction; owl:onProperty sub:partOf; 
                                 owl:someValuesFrom ?classForIndivParts ];
            owl:equivalentClass [owl:unionOf (?classForSubI1Parts  ?classForSubI2Parts)]  }
 WHERE { # ?indiv sub:cParts ( ?p1 ?p2 ) #intuitive but incorrect with SPARQL
           ?indiv sub:cParts [a rdf:List; rdf:first ?p1; rdf:rest [a rdf:List; rdf:first ?p2] ].
         BIND( uri(concat("class_for_",str(?p1))) as ?classForSubI1Parts )
         BIND( uri(concat("class_for_",str(?p2))) as ?classForSubI2Parts )
         BIND( uri(concat("class_for_",str(?indiv))) as ?classForIndivParts ) 
       };



DELETE { ?p sub:c_cParts (?p1 ?p2 ?p3 ?p4 ?p5)  }
 INSERT{ ?p2345 sub:c_cParts (?p2 ?p3 ?p4 ?p5).  ?p sub:c_cParts (?p1 ?p2345)  }
 WHERE {#?p sub:c_cParts (?p1 ?p2 ?p3 ?p4 ?p5)  #intuitive but incorrect with SPARQL
         ?prop sub:c_cParts [a rdf:List; rdf:first ?p1; 
                             rdf:rest[a rdf:List; rdf:first ?p2;
                                      rdf:rest[a rdf:List; rdf:first ?p3;
                                                rdf:rest[a rdf:List; rdf:first ?p4;
                                                         rdf:rest [a rdf:List; rdf:first ?p5] ]]]]};
DELETE { ?p sub:c_cParts (?p1 ?p2 ?p3 ?p4)  }
 INSERT{ ?p234 sub:c_cParts (?p2 ?p3 ?p4).       ?p sub:c_cParts (?p1 ?p234)   }
 WHERE {#?p sub:c_cParts (?p1 ?p2 ?p3 ?p4)  #intuitive but incorrect with SPARQL
         ?p sub:c_cParts [a rdf:List; rdf:first ?subI1; 
                     rdf:rest [a rdf:List; rdf:first ?p2;
                                rdf:rest [a rdf:List; rdf:first ?p3;
                                                      rdf:rest [a rdf:List; rdf:first ?p4] ] ] ] };
DELETE { ?p sub:c_cParts (?p1 ?p2 ?p3)  }
 INSERT{ ?p23 sub:c_cParts (?p2 ?p3).            ?p sub:c_cParts (?p1 ?p23)    }
 WHERE {#?p sub:c_cParts (?p1 ?p2 ?p3)  #intuitive but incorrect with SPARQL
         ?p sub:c_cParts [a rdf:List; rdf:first ?subI1; 
                                    rdf:rest [a rdf:List; rdf:first ?p2;
                                               rdf:rest [a rdf:List; rdf:first ?p3] ] ] };
DELETE { ?class sub:c_cParts ( ?p1 ?p2 ) }
 INSERT{ ?class sub:c_part ?p1, ?p2;   owl:equivalentClass [owl:unionOf (?p1  ?p2)]  }
 WHERE { # ?class sub:c_cParts ( ?p1 ?p2 ) #intuitive but incorrect with SPARQL
           ?class sub:c_cParts [a rdf:List; rdf:first ?p1; rdf:rest [a rdf:List; rdf:first ?p2] ].
       };




#************************ 1.4. Contextualizing Or Negating Relations

DELETE { ?rt1 sub:propertySymmetricNegation ?rt2 }
 INSERT{ [] rdf:type  owl:NegativePropertyAssertion;  owl:assertionProperty ?rt2;
            owl:sourceIndividual ?indiv1;  owl:targetIndividual ?indiv2 .
         [] rdf:type  owl:NegativePropertyAssertion;  owl:assertionProperty ?rt2;
            owl:sourceIndividual ?indiv2;  owl:targetIndividual ?indiv1 . }
 WHERE { ?rt1 sub:propertySymmetricNegation ?rt2 .  ?indiv1 ?rt1 ?indiv2 };


DELETE { ?class sub:c_part_exclusion ?class2 } 
 INSERT{ ?class rdf:type rdfs:Class; 
                rdfs:subClassOf [rdf:type owl:Restriction;  owl:onProperty sub:part_exclusion;
                                 owl:allValuesFrom ?class2]. } 
 WHERE { ?class sub:c_part_exclusion ?class2 };