redefine and declare property in RDFS - semantic-web

I want to create a RDFS schema about venue info which contains for example:
address info.
I find another schema about it:https://schema.org/Place which has the property address info.
The first question is can I declare the Venue also has the property of address?
I already know that I can use the property without declaring it. The reason I want to declare it to make my schema more clear.
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:place="https://schema.org/Place#"
xml:base="http://localhost:3000/VenueSchema#">
<rdfs:Class rdf:ID="Venue">
<rdfs:subClassOf rdf:resource="https://schema.org/Place"/>
</rdfs:Class>
<rdf:Property rdf:ID="address">
<rdf:type source:"https://schema.org/Place#address">
</rdf:Property>
</rdf:RDF>
The second question is can I redefine the property address? Can it achieve override or overload effects?
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:place="https://schema.org/Place#"
xml:base="http://localhost:3000/VenueSchema#">
<rdfs:Class rdf:ID="Venue">
<rdfs:subClassOf rdf:resource="https://schema.org/Place"/>
</rdfs:Class>
<rdf:Property rdf:ID="address">
<rdfs:domain rdf:resource= "#Venue">
<rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
</rdf:Property>
</rdf:RDF>

The first question is can I declare the Venue also has the property of
address? I already know that I can use the property without declaring
it. The reason I want to declare it to make my schema more clear.
Classes don't have properties in RDFS. Properties can have declared domains and ranges, but that doesn't make properties belong to classes. When you say that
p rdfs:domain D
you're saying that when x p y, you can infer that x rdf:type D. That's all the domain axiom does. The range axiom is similar, but lets you infer a type for y. You can declare additional domains and ranges on a property, but be aware that that means that you'll be able to infer that with that property belong to all the domains. E.g., if you say that:
hasFoot rdfs:domain Elephant
and
hasFoot rdfs:domain Human
then when you see that Jimbo hasFoot foot73, you're going to be able to infer that Jimbo is a Human and an Elephant.
The second question is can I redefine the property address? Can it
achieve override or overload effects?
You can say additional things about resources; that's one of the wonderful things about the Semantic Web. However, you can't make anyone else retract what they've said about, though you're free to ignore what they've said. That is, you can include declarations of a property even if someone else has already declared them. The RDF data model is based on a set of triples, and triples don't include duplicates, so there's no difference whether you say something once or a hundred times.
It doesn't make sense to talk about overriding or overloading, though. I've said it before in the answers to some of your earlier questions, but RDF is not an object oriented programming language, even though it has a notion of properties and classes. A property is just an IRI. It doesn't have any behavior or side effects. You can say additional things about a property, and you ignore things that others have said about them, but there's sense in which you can override or overload a property.
You can define subproperties, which might be useful. E.g., you can say:
:hasParent a rdfs:Property ;
rdfs:range :Human .
:hasMother a rdfs:Property ;
rdfs:range :Woman ;
rdfs:subPropertyOf :hasParent .
If you do this, then when you say x hasMother y, you can infer that y is a Woman and a Human, and you can infer that x hasParent y.

Related

Do all ontologies that import 'owl' or 'rdf', implement 'domain', 'range' and other related predicates?

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.

Multiple disjoint classes in rdf range constraint

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.

Is dcterms:identifier an inverse functional property?

To me, the dcterms:identifier property seems like a legitimate inverse functional property. When two things share the same identifier, I think it is safe to conclude that it is the same thing.
Is there any compelling reason not to define it as such (owl:InverseFunctionalProperty) in my ontology?
If you need to stay in OWL 2 DL, then it's not a good idea to declare data properties to be inverse functional - only object properties can be declared as such without violating the constraints and end up in OWL 2 FULL.
dcterms:identifier has a range of rdfs:Literal defined here
You could use a HasKey axiom to achieve similar results: keys were introduced in OWL 2 for the purpose of identifying one or more properties whose values are identifiers for the referring individuals, and both object and data properties can be used.

How to declare a custom class relation in OWL2

My apologies if my question is too basic, but after some time looking for an answer, I had nowhere to go but here.
Suppose the following classes in an ontology (expressed in an OWL 2 file):
<owl:Class rdf:ID="ClasseOne">
</owl:Class>
<owl:Class rdf:ID="ClasseTwo">
</owl:Class>
What I have is 1000 instances of ClassOne and 5000 instances of ClassTwo. In my reality all the ClassOne instances are related in the very same way (let's say the relationship is named "isRelatedTo") to all the instances of ClassTwo.
My idea was to declare a class relation and use it in the declaration of ClassOne, instead of having an ObjectProperty that should have its value declared in each ClassOne instance.
How to accomplish that?
Thanks in advance!
Classes are not related by properties in OWL except for subsumption/equivalence. Usually, individuals of a class A are related to individuals of a class B by a property p, e.g. A(a1), B(b1), p(a1, b1) states that an individual a1 of class A is related by p to an individual b1 of class B.
You could express something like any individual of A has a relationship p to an individual of B by using a subclass axiom with an OWL class expression as super class, e.g.
Class: A
SubClassOf: p some B
(in Manchester OWL Syntax here)
Note, that this doesn't necessary mean the other way around, i.e. the direction matters.

owl how to (if possible ) annotate an owl:class

I used to annotate a predicate like the following:
<rdf:Description rdf:about="http://music.org/musicontology/mo#fromEra">
<rs:hasSimilarityValue rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.1</rs:hasSimilarityValue>
</rdf:Description>
where fromEra is a predicate and has a property called hasSimilarityValue which its value is 0.1
I would like to do the same for some classes, I dont' know if that is possible in owl or not, I supposed that is possible because when looking for the owl generated from my protege i can see the followings:
<!-- http://music.org/musicontology/mo#JoyfulFeeling -->
<owl:Class rdf:about="http://music.org/musicontology/mo#JoyfulFeeling">
<rdfs:subClassOf rdf:resource="http://music.org/musicontology/mo#Feeling"/>
</owl:Class>
so it sounds that it is possible to do that.
Just to make my question clear, I would like to end up with something like this:
JoyfulFeeling is a class that has a property called hasSimilarityValue, which its range is double
In general there is no problem having properties associated with a class. If the property is of type owl:AnnotationProperty, then reasoners will ignore it, if running a reasoner is a concern at all.