Is dcterms:identifier an inverse functional property? - semantic-web

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.

Related

Regions of adjacent line portions with the same dataproperties in Protégé 5

I try to process line-based data using protege 5 and picture similar "regions" of a curve.
So I have a curve, which is deconstructed into portions of equal lengths in my ontology (class Portion, instances p_1, ... ,p_n). The portions are defined by their start- and endpoints (point_1, ... ,point_n+1), furthermore, the radius of the curve is stored in the ontology as data property of the instances (p_1, ... ,p_n). I managed to reason the adjacency relations between the different portions
hasStartPoint(p_2,point_2) o isEndpointOf(point_2,p_1) => isNextOf(p_2, p_1)
hasEndPoint(p_1,point_2) o isStartpointOf(point_2,p_2) => hasNext(p_1, p_2)
I also managed to create defined classes, storing portions with the same radius.
So here is my question: I want to reason the sets of portions (regions), which are adjecent and share the same curve radius. Then, i instances of a class Set should be created, for i different radius and non-adjecent sets, individuals (region1, ... ,regioni).
Here is the exemplary data I want to process: data I want to process
In other words: if a radius appears twice on the given line, and the portions of this radius are not adjacent, they should not be part of the same region. Further, regions should be created automatically when adding portions of different radius. The only idea I have, is to somehow traverse the set of portions with a loop over the isNext triplet, which requires some coding I guess, but I can't find anything alike here...
I hope, my problem is clear and I am happy to read if anybody has an idea on it.
Thank you in advance
Julian
From the owl-api tag, I infer you're looking to write code that uses the OWL API to reach your objective (You didn't mention which reasoner you're using in Protege - you'll need to use the same reasoner in your code to get things like hasNext relations inferred).
In OWL API, I'd do something like the following:
Infer the hasNext triples, if they are not already stored in the ontology file
For each of the defined classes that separate instances with the same radius
Retrieve all individuals of that class
Retrieve all property assertions with hasNext
Aggregate these instances into regions - e.g., seed one region for each property assertion, then merge two regions if their instances all belong to the same defined class and an endpoint in one region is a startpoint in the other. Repeat until only one region is left for a defined class (I believe, from your problem description, that regions cannot span outside of instances with the same radius) or until no further merges can happen.
In terms of OWLAPI implementation, once you have the ontology loaded in an OWLOntology object, you'd create an OWLReasoner with the OWLReasonerFactory implementation available for the reasoner of your choice (examples of this exist in the OWLAPI wiki), then there are a number of methods that can come in handy:
(Referencing OWLAPI 4 here because that's what Protege uses)
Get all individuals of a class: OWLOntology::getClassAssertionAxioms(OWLClassExpression) gives all axioms stating an individual belongs to a class, useful to retrieve instances of your defined classes. Through OWLReasoner, you can use OWLReasoner::getInstances(OWLClass)
Get all object property assertions for an individual: OWLOntology::getObjectPropertyAssertionAxioms(OWLIndividual). Useful to get hasNext values. Through the reasoner, this would be OWLReasoner::getObjectPropertyValues(OWLNamedIndividual, OWLObjectPropertyExpression)
I believe the rest of the algorithm can be implemented without OWLAPI specific code.

What is the meaning of "Equivalent To" in Protege?

I am studying OWL and I am trying to build an Ontology using Protege.
I found an option called Equivalent To in Protege.
What is that option for please? Is it for dividing the space of instances? or is it to set the Object properties that a class can have?
Equivalent to applies to class expressions, object properties and data properties.
Equivalence in class expressions
In class expressions, equivalence means that two classes have the same individuals in any interpretation (i.e., the two classes are alternate names, or equivalent definitions, for the same set of individuals).
Equivalence in data and object properties
For object and data properties, asserting that two properties are equivalent means that their domains and ranges apply to both properties, and that every assertion using one property can be rewritten as using the other.
Example
For example, suppose I declare a hasOwner object property and an ownedBy as equivalent, then: MyCar hasOwner Me implies MyCar ownedBy Me.

How do I define relation properties in OWL?

In my ontology I have individuals "pic Joan" which is an instance of concept "mountain" and "port Cerbère" which is an instance of concept "village". I have the relation "dominates" going from "pic Joan" to "port Cerbère" (in the sense that the mountain is perceived as being close and above the village, and hence "dominates it").
But in fact, I need to represent the information "pic Joan dominates port Cerbère at a distance of 1.5 miles NW".
So, logically, I would need to attach to the relation "dominates" the data properties "distance=1.5M", "direction=NW".
But, AFAIK, OWL does not provide properties for relations. I know that I can define range and domain for relations, but this is not about range and domain, the same relation will have different property values when taken between different instances.
How would you represent this information in OWL?
(Auxiliary question: is there some other ontology formalism where I can define properties for relations? And if yes, are there tools like Protégé to manage ontologies in that formalism?)
The most common pattern for this use case is to introduce a new class, say RelativePosition:
RelativePosition a Class.
relationType a DataProperty.
relationType domain RelativePosition.
// relationType values not specified here: might be "dominant","overlooking"...
// depending on your needs, this might need more structure.
firstFeature a ObjectProperty.
firstFeature domain RelativePosition.
secondFeature a ObjectProperty.
secondFeature domain RelativePosition.
// both properties can appear multiple times for one instance of RelativePosition
// to group sets of entities which share a relative position
More properties can be added to introduce distance, or other characteristics.
Edit: copied link from Joshua's comment below: for n-ary relations, see here
is there some other ontology formalism where I can define properties for relations?
Have you looked into Topic Maps?

Overextending object design by adding many trivial fields?

I have to add a bunch of trivial or seldom used attributes to an object in my business model.
So, imagine class Foo which has a bunch of standard information such as Price, Color, Weight, Length. Now, I need to add a bunch of attributes to Foo that are rarely deviating from the norm and rarely used (in the scope of the entire domain). So, Foo.DisplayWhenConditionIsX is true for 95% of instances; likewise, Foo.ShowPriceWhenConditionIsY is almost always true, and Foo.PriceWhenViewedByZ has the same value as Foo.Price most of the time.
It just smells wrong to me to add a dozen fields like this to both my class and database table. However, I don't know that wrapping these new fields into their own FooDisplayAttributes class makes sense. That feels like adding complexity to my DAL and BLL for little gain other than a smaller object. Any recommendations?
Try setting up a separate storage class/struct for the rarely used fields and hold it as a single field, say "rarelyUsedFields" (for example, it will be a pointer in C++ and a reference in Java - you don't mention your language.)
Have setters/getters for these fields on your class. Setters will check if the value is not the same as default and lazily initialize rarelyUsedFields, then set the respective field value (say, rarelyUsedFields.DisplayWhenConditionIsX = false). Getters they will read the rarelyUsedFields value and return default values (true for DisplayWhenConditionIsX and so on) if it is NULL, otherwise return rarelyUsedFields.DisplayWhenConditionIsX.
This approach is used quite often, see WebKit's Node.h as an example (and its focused() method.)
Abstraction makes your question a bit hard to understand, but I would suggest using custom getters such as Foo.getPrice() and Foo.getSpecialPrice().
The first one would simply return the attribute, while the second would perform operations on it first.
This is only possible if there is a way to calculate the "seldom used version" from the original attribute value, but in most common cases this would be possible, providing you can access data from another object storing parameters, such as FooShop.getCurrentDiscount().
The problem I see is more about the Foo object having side effects.
In your example, I see two features : display and price.
I would build one or many Displayer (who knows how to display) and make the price a component object, with a list of internal price modificators.
Note all this is relevant only if your Foo objects are called by numerous clients.

Finding variables that share common properties

I'm using Mathematica and have a set of variables (A,B,C,D,...) with properties A=(blue, big, rounded), B=(red, small, spiky), and so forth. Those properties can be common between variables. What would be the best, general way to find all variables that share a common property (of being, for instance, small)? Thanks.
Here's a list of possible properties:
In[1]:= properties={"red","green","blue","big","small","rounded","spiky"};
And here's a list of objects with some of those properties
In[2]:= list={{"blue","big","rounded"},{"red","small","spiky"},
{"red","big","rounded"},{"blue","small","spiky"}};
You can find all objects that have the property of, e.g., being "blue" using Select
In[3]:= Select[list, MemberQ[#,"blue"]&]
Out[3]= {{blue,big,rounded},{blue,small,spiky}}
This could be wrapped up into a function. Although how I would write that function would depend on the data structures and usage that you're planning.
Actually, I just reread you question you have a list of objects with some properties and you want to refer to those objects by name. So you probably want something more like
In[1]:= listProperties["A"]:={"blue","big","rounded"}
listProperties["B"]:={"red","small","spiky"}
listProperties["C"]:={"red","big","rounded"}
listProperties["D"]:={"blue","small","spiky"}
Above I defined some properties that are associated with certain strings. You don't have to use strings in the above or below, and you can create a better structure than that if you want. You could also make a constructor to create the above, such a constructor could also check if the list of properties supplied is of the right form - i.e. does not have contradictory properties, are all in a list of known properties etc...
We then define a function to test if an object/string has a certain property associated with it
In[2]:= hasProperty[obj_, property_]:=MemberQ[listProperties[obj],property]
You might want to return an error or warning message if listProperties[obj] does not have a definition/rule associated with it.
Use Select to find all "objects" in a list that have the associated property "blue":
In[3]:= Select[{"A","B","C","D"}, hasProperty[#,"blue"]&]
Out[3]= {A,D}
There are other ways (probably better ways) to set up such a data structure. But this is one of the simplest ways in Mathematica.