Adding multiple domains to objectProperty in Protege 5 - semantic-web

I have created an ontology using Protege 5-beta-17. In my ontology I have some classes:
Mountain, Lake, Location etc...
I also have an object property:
hasLocation.
For this object property I have set the range the "Location" class, and the domain
the "Mountain" and "Lake" classes.
When I try to view the ontology using the CMap tool it shows that only the
"Mountain" "hasLocation" "Location".
The "Lake" class is presented without the "hasLocation" object property.
Did I do something wrong? Ore do I have do something else in Protege?

I found out what the problem was.
When adding a domain/range to object property in protege you have to click the following buttons and select one of your classes:
If you want to add another domain/range you simply click one of the buttons again and add another class. If you are doing it like this your telling Protege that the domain/range of your object property is an INTERSECTION of two classes. This means that the individual that will take the domains/ranges place is an INSTANCE OF BOTH CLASSES and NOT EXCLUSIVELY OF ONE OF THEM.
This was my mistake. I was adding the classes to the domain in the wrong way.
So... The correct way for adding multiple distinct domains for an object property is the following:
Simply click the domain/range button again and select the "Class expression editor" tab:
And in the "Class expression editor" type in your classes like this: "ClassA or ClassB or ClassC or ...".
In my case it was "Mountain or Lake".
After that click "ok" and thats it.

Related

How to deal with class instances in Jena?

In an ontology, suppose we have a class named "function" it has two instances "func1" and "func2" and suppose that the class has a data property "d".
My first problem is: how can I create individuals corresponding to either "func1" or "func2" ?
My second problem is : In the inference, with Jena rules, I want to check if individuals created for "func1" have "d" greater than some value and if individuals created for "func2" have "d" greater than another value.
I already know how to work with classes, properties and individuals but when I got to the part having instances I got stuck.
It appears that Jena Library has no support for instances, which means that you can't use getInstance() and create individuals for that instance.
Instead of having instances func1 and func2, you can make them as subclasses for the class function. This way, you can use getOntClass() and createIndividual() or getIndividual() as usual.

Saving Entity does not update class-hierachy labels correctly

I have an abstract superclass Report and two Subclasses SimpleReport and ExtendedReport, which I want to persist in my database.
If a SimpleReport is created, it has the labels "Report" and "SimpleReport" attached to it, as expected.
A user can modify such a SimpleReport, which leads to the SimpleReport becoming an ExtendedReport.
If I now save this ExtendedReport (using the same ID as the SimpleReport, because I just want to update it) it has the labels "Report", "SimpleReport"and "ExtendedReport" attached to it.
IMHO the label "SimpleReport" should be removed on save. I`m currently deleting the wrong label using a cypher query after saving the updated report.
I´m asking if there is a better way to archive this, if may approach is wrong or if this is a bug in ogm?
The rules for labels are as follows:
any plain concrete class in the hierarchy generates a label by default
plain abstract class does not generate a label by default
plain interface does not generate a label by default
any class annotated with #NodeEntity or #NodeEntity(label="something") generates a label
empty or null labels must not be allowed
classes / hierarchies that are not to be persisted must be annotated with #Transient
Therefore if you remove abstract from your base class, or add a #NodeEntity annotation, you will see the results you expect.
Edit:
The OGM does not remove labels when a class is renamed. Any additional labels are left intact.
You can remove these manually using direct database access.
You can declare a field with the #Labels annotation to manage adding/removing additional labels from an entity.

Nepomuk File Ontology

I want to use Nepomuk File Ontology (NFO) in a desktop software. Before starting I need some guidance on using NFO.
Forexample:
In NFO we have File class and Image classes.
File Class properties are: nfo:fileCreated, nfo:fileLastAccessed, nfo:fileLastModified, nfo:fileName, nfo:fileOwner, nfo:fileSize, nfo:fileUrl, nfo:hasHash, nfo:permissions.
And Image Class properties are: nfo:depicts, nfo:horizontalResolution, nfo:verticalResolution
Now Please guide, I have an image file i.e imagefile1.jpeg on which I want to apply properties of both File and Image classes.
which one of the below two methods is the correct method to do so.
Method 1: Create a single Object i.e. obj1 of type File and Image. So
now I can annotate obj1 on properties of File class as well as Image
Class.
Method 2: Create two objects, one of type File i.e. obj1 and second
object of type Image i.e. obj2. and now link these two objects via
interpretedAs and isStoredAs properties.
Please guide me which one is the correct approach so that I follow it in my application.
"InformationElement is a piece of information stored within a data
object. Content-specific properties are defined as properties of an
InformationElement. It is separate from the DataObject in order to
make the interpretation independent of the representation."
Source
Also have a look at the description of data objects
So Method 2 is the way to go, to "apply" the different abstractions the ontology intends.

Linking an individual through an object property to a class?

I have an ontology that contains the following classes:
"Property", "PropertyType". The "PropertyType" class has two sub classes "ReadableProperty" and "WritetableProperty".
The ontology also contains an object property "hasPropertyType" with the domain "Property" and range "PropertyType".
Is it semantically correct to create the following triples (link an individual of a class to a another class through an object property):
PREFIX exmp:<http://example.org/myontology.owl#>
INSERT DATA{
exmp:someindividual rdf:type exmp:Property, owl:NamedIndividual.
exmp:someindividual exmp:hasPropertyType exmp:WritetableProperty.
}
?
Or should I link the individual of the "Property" class to an individual of the "WritetableProperty" class, and not to the class it self?
As of http://www.w3.org/TR/owl-ref/#Property:
OWL distinguishes between two main categories of properties that an
ontology builder may want to define:
Object properties link individuals to individuals.
Datatype properties link individuals to data values.
So to answer your question: the second option is the correct one.
Don't get confused with defining the Domain and Range for object properties on the terminological level, with the actual assertion of a property.

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.