Search code examples
rdfowlrdfs

OWL, define class by data property


for learning purposes for my uni I'm learning about OWL. I'm trying to automaticly classify individuals based on subclass necessary & sufficient conditions.

Now, I have a class smartphone, which has the individual "x" which has a data property "hasCores" "4 integer".

Now I try to automaticly classify it as being a "fast smartphone". I tried doing this by making the new class "fast smartphone" as being a subclass of "smartphone". e.g. (Equivalent to(Smartphone and (hasCores min 2 integer)).

But this doesn't look at the data attribute value, which for this instance is 4, but it looks at the amount of "hasCores" properties an individual has. So if i add 2 hasCore property to the indivual it works. But I want just 1 hasCore property, and have the reasoner look at the value of the hasCore property. Is that even possible?

Thanks in advance.


Solution

  • Now, I have a class smartphone, which has the individual "x" which has a data property "hasCores" "4 integer".

    I hope that you actually mean

    :x :hasCores "4"^^xsd:integer
    

    where the value is a datatyped literal with the datatype xsd:integer.

    What you actually want here is datatype facet reasoning. Not all reasoners necessarily support it, but it is supported in the OWL language. You'd essentially use something like

    FastSmartphone equivalentClass Smartphone and (hasCores only xsd:integer[>4])

    There's a direct example of this type of expression in my answer to Encoding mathematical properties in RDF:

    enter image description here

    Now, there are two directions that you could want inference to go in. You could do a sort of necessary condition, which would get you consistency checking.

    FastSmartphone subclassOf hasCores only xsd:integer[>=4]

    That means that if something is asserted to be a FastSmartphone, then whatever number(s) of cores it has, the value has to be at least four. It would still be possible for it to have no such value, and if you want to prevent that, you might do something like

    Smartphone subClassOf hasCores min 1

    Now, if you want to be able to say that, e.g., a Smartphone has five cores and thereby infer that it's a FastSmartphone, you need the other direction:

    hasCores some xsd:integer[>=5] and Smartphone subClassOf FastSmartphone

    (You might want only there, but then Smartphones with no declared number of cores would also be FastSmartphones.)

    Really, though, if you're trying to define fast smartphones as smartphones that have at least four cores, you'd just say:

    FastSmartphone equivalentClass Smartphone and hasCores some xsd:integer[>=4]

    Related