2

I am new to SPIN. I wonder if it makes sense to use it for the following purpose. Say I have the following class hierarchy:

ex:Vehicle
 ex:Car
   ex:Sedan

Some classes have the property owl:equivalenClass set to some value, for example:

ex:Vehicle
 owl:equivalentClass wd:MeanOfTransportation 
ex:Sedan
  owl:equivalentClass wd:Sedan 

In the case owl:equivalentClass is not set to a value, it should take the value of it's parent class. In the above example:

ex:Car
  owl:equivalentClass wd:MeanOfTransportation 

Can this be accomplished with SPIN, in my case using TopBraid?

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Jay
  • 127
  • 9
  • My first question would be, why do you want to do this? This is exactly what follows from logical inference. – UninformedUser Jul 12 '17 at 23:15
  • @AKSW, I'm not sure it follows (or I don't understand you)... Anyway, the only inference engine available in TopBraid Composer Free Edition is SPIN engine, thus this question makes sense, imho. – Stanislav Kralin Jul 13 '17 at 15:36
  • @StanislavKralin You're right. It only holds for one direction of the equivalence relation, i.e. it only follows that the subclass is a subclass of the equivalent class but not vice versa. – UninformedUser Jul 13 '17 at 17:27
  • Why? - I could write a SPARQL query to extract the value of owl:equivalenClass of the parent class, but I don't want that. I would like to have the statement generated automatically - if none exist. Also I want to learn SPIN... – Jay Jul 13 '17 at 18:00
  • @AKSW, I agree though, it's was initially expected; that by running the inference engine, a subclass should inherit the class property values of it parent. – Jay Jul 14 '17 at 14:52

1 Answers1

2

It makes sense to use SPIN for these purposes, because SPIN inference engine is the only inference engine available in TopBraid Composer Free Edition.

In other TopBraid Composer editions, the appropiateness, as well as the result obtained, may vary depending on your inferencing configuration (Inferences > Configure Inferencing).

The rule is:

rdfs:Class spin:rule [
    rdf:type sp:Construct ;
    sp:text """
    CONSTRUCT {
        ?this owl:equivalentClass ?equivalentClass .
    }
    WHERE {
        ?this rdfs:subClassOf ?superClass .
        ?superClass owl:equivalentClass|^owl:equivalentClass ?equivalentClass .
        FILTER NOT EXISTS {
            ?this owl:equivalentClass|^owl:equivalentClass [] .
        } 
    } """ 
] .

Please note that this SPIN rule is attached to rdfs:Class : a class that instances all these ex:Car, ex:Vehicle are. ?this is a special variable that refers to the "current" instance of this class.

It seems that the spl:InferDefaultValue SPIN template can not be used in your case, because spl:InferDefaultValue doesn't accept SPARQL variables as its spl:defaultValue argument.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
  • 1
    What's the purpose of adding the inverse path (^owl:equivalentClass ) in this case? ?superClass owl:equivalentClass|^owl:equivalentClass ?equivalentClass – Jay Jul 14 '17 at 14:41
  • @Joakim, you can remove it, if you want. In the example, the property (`owl:equivalentClass`) is symmetric. Let us assume that `wd:Sedan owl:equivalentClass ex:Sedan` is asserted and `ex:Sedan owl:equivalentClass wd:Sedan` is not asserted. You may want to infer `ex:goodSedan owl:equivalentClass wd:Sedan` nevertheless. – Stanislav Kralin Jul 14 '17 at 14:48