I would like to refer to external skos vocabularies in an ontology.
More precisely i would like, if possible, to state that the range of a property is one of the skos:concept defined in an existing skos vocabulary.
I think one of the problem is that in owl, a skos:concept is an individual and not a class.
I tried something like this but it is not convincing:
myproperty
a owl:ObjectProperty ;
rdfs:range _:x0 .
_:x0 rdf:type owl:Restriction ;
owl:onProperty skos:inScheme ;
owl:hasValue theskosconceptscheme .
If it is possible, how could I do this properly ?
Thanks
Indeed, the object property range axiom in OWL is used to infer class membership for individuals which are objects of object properties with declared rdfs:range. As such it relates an object property to a class. SKOS concepts and schemes are individuals. So it is not possible to specify a concrete SKOS concept, scheme or collection as rdfs:range of an owl:ObjectProperty in OWL1. However, this is possible in OWL2, as one of the few cases where punning is allowed.
Related
For modelling an isA relationship, (1) is it enough to just make sub-properties or sub-classes?
If not, what is the correct way?
(2) What is the difference of isA and Instance?
From what I understood, isA is a predicate for objects whereas Instance is for demonstrating individuals. But I am not sure.
Thanks.
Yes, to make a sub-class, it’s enough to use the
rdfs:subClassOf property.
# "Y is-a X"
:Y rdfs:subClassOf :X .
In Protégé, this happens automatically if you use the "Add subclass" button.
(The same goes for rdfs:subPropertyOf and the "Add sub property" button.)
The term instance refers to a member of a class.
If you say
ex:Arbo94 rdf:type :Y .
then ex:Arbo94 is an instance of the class :Y, and given the rdfs:subClassOf statement from above, also an instance of the class :X.
It’s also an instance of rdfs:Resource ("the class of everything"), as everything in RDF is a member of this class.
Sorry if this is a noob's and simple question, but it will help me resolve a conceptual confusion of mine! I have some guesses, but want to make sure.
I got the location of a part of brain via NeuroFMA ontology and the query below:
PREFIX fma: <http://sig.uw.edu/fma#>
select ?loc{
fma:Superior_temporal_gyrus fma:location ?loc}
The result was: fma:live_incus_fm_14056
I thought I might be able to get some more information on this item.
Question 1: Was there a difference if the result was a literal?
So, I used optional {?loc ?p ?o} and got some results.
However, I thought since this ontology also imported RDF and OWL, the following queries should work too, but it was not the case (hopefully these codes are correct)!
optional {?value rdfs:range ?loc}
optional {?loc rdfs:domain ?value}
optional {?loc rdf:type ?value}
Question 2 If the above queries are correct, are RDFS and OWL just a suggestion? Or do ontologies that import/ follow them have to use all their resources or at least expand on them?
Thanks!
An import declaration in OWL is, for the most part, just informative. It is typically used to signal that this ontology re-uses some of the concepts defined in the target (for example, it could define some additional subclasses of classes defined in the target data).
Whether the import results in any additional data being loaded into your dataset depends on what database/API/reasoner you use to process the ontology. Most tools don't automatically load the targets of import declarations, by default, so the presence or absence of the import-declaration will have no influence on what your queries return.
I thought since this ontology also imported RDF and OWL, the following queries should work too, but it was not the case (hopefully
these codes are correct)!
optional {?value rdfs:range ?loc}
optional {?loc rdfs:domain ?value}
optional {?loc rdfs:type ?value}
It's rdf:type, not rdfs:type. Apart from that, each of these individually look fine. However, judging from your broader query, ?loc is usually not a property, but a property value. Property values don't have domains and ranges. You could query for something like this, possibly:
optional { fma:location rdfs:domain ?value}
This asks "if the property fma:location has a domain declaration, return that declaration and bind it to the ?value variable".
More generally, whether these queries return any results has little or nothing to do with what import declaration are present in your ontology. If your ontology contains a range declaration for a property, the first pattern will return a result. If it contains a domain declaration, the second one will return a result.
And finally, if your ontology contains an instance of some class, the third pattern (corrected) will return a result. It's as simple as that.
There is no magic here: the query only returns what is present in your dataset. What is present in your dataset is determined by how you have loaded the data into your database, and (optionally) what form of reasoner you have enabled on top of your database.
I want to define multiple classes (with limited inferencing) as the range of an owl objecttypeproperty. Let me explain in detail by providing you an example.
I have two classes: Furniture and Device, which are not disjoint, i.e., another subclass/instance can inherit from both classes, e.g., Lamp can be a furniture and device.
Now I would like to define an OWL objecttypeproperty: hasComponent that can only accept range as either :Furniture or :Device, NOT both.
:hasComponent rdf:type owl:ObjectProperty ;
rdf:type owl:TransitiveProperty ;
rdfs:range :Furniture ,
:Device .
When I create an instance using the property:
:furniture1 rdf:type :furniture .
:device1 rdf:type :device .
:furtniture1 :hasComponent :lamp .
The inferencing engine will infer that :device1 is a :furniture, which I dont want, because I have already defined that device1 is a device.
One solution is to remove rdf:range and explicitly define the instance types, but I did not want to remove the range because it will limit the scope of the search space.
You have to create a union class of all the classes involved and subtract their intersection (example: ((Furniture or Device) and not (Furniture and Device))) and set that class as the range. The same approach needs to be used for domains.
You can declare this as a named class, or insert it (with the necessary RDF/XML structure around it) directly into the range axiom. I would think you'll probably need the same class in multiple places, so a named class might be the best solution.
I am trying to create an OWL ontology using Protege. I want to use inverse functional properties as a resemblance for primary keys from relational databases. For example, I have a property, that has a unique id as object, thus identifying the entity and no other entity should be allowed to use this value with that property.
As the object value is a string, it has to be a data property. But in Protege, you cannot assign the Inverse functional characteristic to a data property.
Why can't I declare a data property to be a inverse functional property and how else should I create the "unique key" logic if not like this?
Thanks in advance,
Frank
The restriction on datatype properties is purely due to computational complexity. Without the restriction, the logic of OWL 2 DL would not be decidable. However, it is possible to express a notion of unique key in OWL 2:
ex:key a owl:DatatypeProperty .
owl:Thing owl:hasKey ( ex:key ) .
However, there is a subtle difference between this and an inverse functional property. Consider the following:
ex:this a [
a owl:Restriction;
owl:onProperty ex:prop;
owl:minCardinality 2;
owl:onClass [
a owl:Restriction;
owl:onProperty ex:key;
owl:hasValue 1
]
] .
If ex:key is a key for owl:Thing, then this ontology is consistent. However, if ex:key could be an inverse functional property, then this ontology would not be consistent. The reason is due to the way keys work in OWL 2. For a key to identify something, the thing has to be named explicitly. There could be several unnamed things having the same key (here, the key is the number 1) and yet, they would not be considered equal as long as they are not declared explicitly in the ontology. However, with inverse functional property, it is not the case. As a result, we would be able to infer that everything having value 1 on property ex:key is the same thing, and therefore, ex:this cannot have 2 values for the property ex:prop.
The following query (preceded by relevant prefixes of course)
posed on an ontology (.owl file) gives the object properties or data properties?
SELECT DISTINCT ?predicate
WHERE { ?subject ?predicate ?object }
Thank you,
It wholly depends on what the data in the triple store or file contains. Variable ?predicate will match the predicate of the triple, and that predicate might be a datatype property or an object property in OWL, or neither of those if you're not querying an OWL ontology. Likewise, ?object will match an RDF resource or a literal, again depending on what the data says.