سؤال

I'm making an Ontology that describes programming languages, but I have the following problem: a language can have strong or weak typing, and I need to limit my schema to these two options... so, how can I do that?

Here's a sample of my schema:

:Language a rdfs:Class .

:typing a rdf:Propery ;
    rdfs:domain :Language ;
    rdfs:range ? .

Thanks in advance.

هل كانت مفيدة؟

المحلول

I disagree with the answer posted by Eduardo Silva. A functional property can have only one value from the range of the function. It can be used multiple times, but an OWL reasoner can make some entailments from those triples. For example, if you have some individual example:x1 and a functional property :p, and you see in your data:

example:x1 :p :foo .
example:x1 :p :bar .

then you are entitled to infer that :foo and :bar must be the same individual, since otherwise the functional nature of :p would be violated. Alternatively, if you know by some other means that :foo and :bar are different individuals, then, given the two additional triples above, your OWL model is inconsistent.

In other words, it would be fine to have two values for test:typing on some resource, as long as you then entail that the two type schemes denoted are in fact the same. Which probably isn't what you want. Moreover, there's nothing to stop a triple store containing a new value for test:typing which wasn't mentioned in the original range description. For example:

:ruby a test:Language ; 
    test:typing test:duckTyping.

This is not inconsistent with test:typing being a functional property.

To restrict the range of a property to be one of a certain enumeration of values, what you actually want is an OWL enumerated class. For example:

test:typing
    a owl:ObjectProperty ;
    rdfs:domain test:Language ;
    rdfs:range [
        owl:oneOf ( test:strongTyping test:weakTyping )
    ].

The extension (set of admissible values) of an enumerated class is exactly the given collection of individuals. No others are allowed.

نصائح أخرى

I think one solution can be to define a "functional property", which is a property that limits the "range" to one member of the class (e.g.: a Person hasGender Gender, where gender can be Female or Male - only one).

This in owl would look something like this (quickly made in Protege):

<owl:ObjectProperty rdf:about="&test;typing">
    <rdf:type rdf:resource="&owl;FunctionalProperty"/>
    <rdfs:domain rdf:resource="&test;Language"/>
    <rdfs:range rdf:resource="&test;Type"/>
</owl:ObjectProperty>

(then Type, would have sub-classes: strong and weak).

Hope this helps.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top