Set default value to property with SPIN

323 views Asked by At

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?

1

There are 1 answers

2
Stanislav Kralin On

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.