I'm currently learning how to use linked data and specifically how to deal with ontologies and with semantic data.
To do this I'm diving into OWL and I'm trying to model a simple work environment. For the problem I have the following to parts are of interest
the Employee class
the Projects class
the :worksOn relation between an Employee and a Project
If I now have
Employee1 :worksOn Project1
Employee2 :worksOn Project1
is there any way to model a property :worksWith, such that in this example case Employee1 :worksWith Employee2 could be derived without explicitly stating it? So basically I want to know if it is possible to define a relation via another relation?
The proposition of Joshua Taylor is the right one. I've tested it under Protégé 5.0.0 beta 17.
You have to use the Machester OWL Syntax to define the worksWith object property:
worksOn o inverse (worksOn) subPropertyOf worksWith
Then using any of the reasoners (HertmiT, Fact++ or Pellet) you obtain the desired inference (in yellow).
Related
I have an ontology in Protege and want to write some SPARQL queries.
The ontology is set up like this:
Thing > Beverages > Wine > Red_wine
Then I have added different red wines as instances. They also have some object properties like fromCountry, goesWellWith and priceRange
How do I create a SPARQL query for returning for example a red wine from France, that goes well with pork, and priceRange 100-199?
If you want to return certain resources in your knowledge base you need a SELECT query.
As the commenters have stated, it is not possible to answer your question exactly as you didn't provide enough information on how your data is modelled and you are expected to show your own efforts and where they failed.
You can find an detailed overview of SPARQL 1.1 at https://www.w3.org/TR/2013/REC-sparql11-overview-20130321/ or a more approachable tutorial at https://www.w3.org/2009/Talks/0615-qbe/.
As far as I can guess from your question, your query should look similar to this:
SELECT ?wine WHERE
{
?wine a :RedWine;
:goesWellWith :Pork;
:priceRange :PriceRange100To199.
}
Please adapt this query to your exact model and show us your results.
If you mean "just one result" with "a red wine", you can add "LIMIT 1".
You could also model the price range differently, for example by having a minPrice and maxPrice, as this would enable more precise queries using filters.
P.S.: I changed your :Red_wine to :RedWine as camel case is usually used for class URIs.
I have modeled an ontology using Protégé and have a class ArchitectureFragment with the following property:
SubClassOf:
modeledIn some Diagram
To perform SPARQL queries I use Apache Fuseki Server Endpoint.
I'd like to retrieve the information that ArchitectureFragment is modeledIn some Diagram.
How do I retrieve this subClass relation using SPARQL? When I just query for rdf:subClassOf I just get something like _:b0 and I have no clue how to interpret that. I even tried querying for _:b0 to see what it is but the results don't make sense to me. Is there any other way?
I am tying to integrate my ontology with another ontologies. what i did is importing the ontologies in my protege, that works, but protege lists all the classes, which is normally. i am looking if there is a way in which i just the reference (uri) of these ontologies and then i can use them from their prefix.
ofc, i am building my ontology using owl2
i hope you help me
If you want to completely reason and materialise facts based on terms relating to the referenced concept, then you will need to fully import the ontology that the referenced concept belongs.
e.g given an external ontology with the following statements:
ex:Person a owl:Class;
rdfs:subClassOf ex:Agent.
If you reference this in your without importing:
ex2:Doctor a owl:Class;
rdfs:subClassOf ex:Person.
and make the following statement:
ex2:Jack a ex2:Doctor.
an run it through a reasoner, then you will also materialise the following:
ex2:Jack a ex:Person.
But not the following:
ex2:Jack a ex:Agent.
To materialise the latter, you will need to import the ontology with all the statements about ex:Person.
I have a simple question which I suspect has no simple answer. Essentially, I want to check whether it is true that one OWL expression (#B) follows on logically from another (#A) - in other words I want to ask: is it true that #A -> #B?
The reason for this is that I'm writing a matching algorithm for an application which matches structures in a knowledge based (represented by the #KnowledgeStructure class) to a structure which describes the needs of the current application state (#StateRequirement). Both structures have properties which have string values representing OWL expressions over the state of a third kind of structure (#Model). These are: #KnowledgeStructure.PostCondition which expresses how the knowledge structure being applied to #Model will transform #Model; and #StateRequirement.GoalCondition, which expresses the #Model state that the application aims to achieve. I want to see, therefore, if the #KnowledgeStructure will satisfy the #StateRequirement by checking that the #KnowledgeStructure.PostCondition produces the desired #StateRequiremment.GoalCondition. I could express this abstractly as: (#KnowledgeStructure.Postcondition => #StateRequirement.GoalCondition) => Match(#KnowledgeStructure, #StateRequirement). Less confusingly I could express this as: ((#A -> #B) -> Match(#A, #B)) where both #A and #B are valid OWL expressions.
In the general case I would like to be able to express the following rule: "If it is true that the expression #B follows from #A, then the expression Match(#A, #B) is also true".
Essentially, my question is this: how do I pose or realise such a rule in OWL? How do I test whether one expression follows from another expression? Also, are existing reasoners sufficiently powerful to determine the relation #A -> #B between two expressions if this relation is not explicitly stated?
I'm not 100% sure that I fully understood the question, but from what I grasped I would face the situation in this way.
First of all I refer to Java because all the libraries I know are meant for this language. Secondly, I don't think that OWL on its own is able to satisfy your goal, given that it can represent rules and axioms, but it does not provide reasoning, that is, you need a reasoner, so you need to build a program that uses it, plus doing additional processing that I will sketch below:
1) You didn't mention it, but I guess you have an underlying ontology w.r.t. you need to prove your consequence relation (what you denote with symbol "->"). If the ontology is not explicit, maybe it can be extracted/composed from the textual expressions you mentioned in the question.
2) you need to use a library for ontology manipulation, I suggest OWL API from Manchester University, it is very powerful and simple, in the tutorial under section "documentation" you have an overview of the main functionalities, including the use of reasoners (the example shows Hermit, but the principle holds for any other reasoner).
3) At this point you need to check if the ontology is consistent (otherwise anything can be derived, as it often happens with false premises)
4) You add the following axiom to the ontology (you build it directly in Java, no need to serialize back, you can let the reasoner work on the in-memory representation) and check for consistency: A \sqsubseteq B, that is, using the associated interpretation: A^I \subseteq B^I, so it is equivalent to A => B (they have the same truth table).
5) At this point you can add the axiom Match(A,B), where A and B are your class expressions and Match is a Role/Relation that relates all the class expressions for which the second is a consequence of the first.
6) After a number of repetitions of these steps you may want to serialize the result and store it, and this again can be achieved quite simply using OWL API from the in-memory representation.
For some basics about Description Logics (the logic underpinning OWL ontologies) you can refer to A description logic Primer (2012), Horrocks et al. and to Foundations of Description Logics (2011), Rudolph.
I'm not a logician or a DL expert, so please verify all the information I provided and feel free to correct me :)
I knew this might be a stupid question but I don't know the answer :)
I am using protege4 I built my ontology and when I tried to use DL Query from the DL query tap in protege4 it executes fine and I get results.
However, when I click "Add to ontology" to add my query to the ontology it adds it but without any query results!!! Why are there no query results? and how to see it?
Thanks
First some terminology:
Every OWL ontology is a set of OWL axioms.
Every DL-Query is an OWL class expression.
Every DL-Query result is a set of OWL entities.
You can only add axioms to an ontology. You cannot add class expressions nor sets of entities to an OWL ontology.
The "Add to ontology" button seems to create a new EquivalentClasses-axiom on the basis of the query (i.e. class expression), and a named class (given by the user), and then asserts this axiom into the active ontology, i.e.
EquivalentClasses(new_name query)
(I didn't quite get it working like this in my version of Protege 4, but such a functionality would make sense.)
The current OWL2 specification does not say anything about how to store class expressions and query results in the ontology. These have to be specified and calculated every time from scratch after you load the ontology from the file.