I need to personalize the individuals of an ontology - owl

Well, I have an ontology and I want to add some individuals. The problem is that individuals vary from one user to another. Let me give you an example:
In the class "pet" I want to add my dog "cookie", I can do it directly on the ontology but when somebody else uses the same ontology it would be filled with my information. Do you know any way to add new individuals to the ontology without modifying the original?
I'ts some kind of personalization. I don't know how to search for work related to this problem, if you know something I would appreciate it. Thank you!

Note: this is the answer I posted for (and that was accepted for) the same question on answers.semanticweb.com, Add new individuals to an ontology.
You would typically create a new ontology that imports the original (so that you have declarations of the classes, properties, etc.), and then declare your individual in the new ontology. For instance,
pet-import (http://example.org/pet-import)
#prefix : <http://example.org/pet-import#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
:Pet a owl:Class .
<http://example.org/pet-import>
a owl:Ontology .
my-pets (http://example.org/my-pets)
#prefix : <http://example.org/my-pets#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://example.org/my-pets>
a owl:Ontology ;
owl:imports <http://example.org/pet-import> .
:Cookie a owl:NamedIndividual , <http://example.org/pet-import#Pet> .

Related

Do I put the ontology in blazegraph together with the data?

I'm trying to learn how to use Blazegraph.
I have created an ontology and added it to the database. No problems. Blazegraph seems easy to use.
Now to my question. I notice that if I query the database now, I get triples from the ontology as answers from sparql queries. So if I add data to the same database, the answers from sparql queries will be from the ontology mixed with the data itself.
Should I not keep the ontology in the same database, or how do I avoid mixing the ontology with the data?
To avoid mixing the ontology with the data, you can namespace the ontology. For example,
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#JW>
a foaf:Person ;
foaf:name "James Wales" ;
foaf:mbox <mailto:jwales#bomis.com> ;
foaf:homepage <http://www.jameswales.com> ;
foaf:nick "Jimbo" ;
foaf:depiction <http://www.jameswales.com/aus_img_small.jpg> ;
foaf:interest <http://www.wikimedia.org> ;
foaf:knows [
a foaf:Person ;
foaf:name "Angela Beesley"
] .
<http://www.wikimedia.org>
rdfs:label "Wikimedia" .
rdf, rdfs, and foaf are all ontologies. Instead of bringing all of them into the document, they're declared in the namespace. You can point the namespace to your owl file (or whatever your ontology is in) and use it the same way. Blazegraph will still be able to reason over the graph as long as it can access the ontology definition.

How do owl and rdfs property domain range work?

I am trying to understand the semantics of rdfs domain and range. Because I am from an object oriented background, I am struggling to understand the semantics and how to validate data against the rdfs statements.
Here is a sample file in turtle format:
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix tmpl: <http://template.example.com/>
prefix data: <http://data.example.com/>
tmpl:Thing a owl:Class.
tmpl:Employment rdfs:subClassOf tmpl:TemporalThing.
tmpl:Party rdfs:subClassOf tmpl:Thing.
tmpl:Individual rdfs:subClassOf tmpl:Party.
tmpl:Organisation rdfs:subClassOf tmpl:Party.
tmpl:LimitedLiabilityCompany rdfs:subClassOf tmpl:Organisation.
tmpl:hasCurrentEmployer a owl:ObjectProperty;
rdfs:domain tmpl:Party;
rdfs:range tmpl:Party.
data:Simon a tmpl:Individual;
skos:prefLabel "Simon S".
data:PtyLtd a tmpl:LimitedLiabilityCompany.
data:Simon tmpl:hasCurrentEmployer data:PtyLtd.
tmpl:Animal a owl:Thing.
data:Beans a tmpl:Animal.
data:Simon tmpl:hasCurrentEmployer data:Beans.
I am using GRAPHDB as my test environment. I would expect the last statement to fail with some sort of message because 'Beans' is an 'Animal' which is not a 'Party'.
Yet, GRAPHDB just accepts the statement.
Any ideas?
EDIT
Based on Stanislav's comment below: While An inference engine might not have a problem with this, we can use the domain and range for error checking in an application.
As said in the comments, you misunderstood the semantics of domain and range.
P rdfs:domain D
P rdfs:range R
mean that if a statement s P o holds, then (with a reasoner running), it could be inferred that s rdf:type D and o rdf:type R.
Domain and range are never restrictions on the the property. That has to be clear.
To understand how things work, check for examplem OWL direct semantics for object properties here.

Protege 5; find all classes related by a to-one cardinality to a specific class

I have OWL ontology, Protege 5. I want starting form a source class S, to retrieve all destination classes D where S is related to Ds by means of to-one cardinality through objectProperty i.e S ([0..*] - 1) D despite what is the connecting objectProperty.
In DL, it would be something similar to :
S ⊑ =1r:D;
where S is my source concept, D is a variable concept and r is a variable objectProperty.
First Point:
How to express this in Manchester Syntax to use it in Protege DL query?
Second Point:
For such query, what are the considered types of property restriction that the reasoner will consider when trying to answer the query? e.g cardinality restriction, functional properties, someValuesFrom, allValuesFrom?
Thanks.
You can't write the kind of query that you're asking about in the DL query syntax. The DL query syntax doesn't have any place for variables; all you can write are class expressions, after which you can ask for the individuals in that class, or subclasses or superclasses of the class. So the answer to the first question is that you can't express your query in the Manchester syntax.
For the second point, there may be reasoners that can help you draw a conclusion here. For instance, you might be able to use a reasoner that supports SPARQL queries and write the template of the class expression with variables. You'd end up with something like this (but this is untested):
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?s ?p ?d where {
?s rdfs:subClassOf [ a owl:Restriction ;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
owl:onProperty ?p ;
owl:onClass ?d ]
}
I don't know whether or not most OWL reasoners will be able to handle that though. As mentioned above, the typical task for an OWL reasoner is to look at class expression and determine its subclasses, and superclasses. This is getting more complicated.

DL query for individuals not connected to others by a property

I have an OWL ontology with three interconnected individuals: a, b, and c, and also has two isolated individuals x, and y.
interconnected individuals:
have at least one outbound object property assertion. e.g.: a hasRelationWith b; or
have at least on inbound object property assertion e.g.: such c, as b hasRelationWith c.
isolated individuals:
have zero outbound object property assertion e.g.: x hasRelationWith [no individual]; and
have zero inbound object property assertion e.g.: such x, as [no individual] hasRelationWith x.
Is it possible to classify (by logical inference, not by enumeration) all the isolated individuals using a DL Query (in Protégé 4.3, if it makes a difference), and if it is possible, how do I do it?
My intuitive guess is something like: (hasRelationWith min 0 Thing) exclude (hasRelationWith min 1 Thing), but DL-Query seems not supporting Set Subtraction syntax...
UPDATE: The following SPARQL can make it, although it cannot be used within class definition.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX my: <http://localhost:8080/ontology/untitled-ontology-26#>
SELECT DISTINCT ?src_obj
WHERE {
?src_obj a owl:NamedIndividual .
minus {?src_obj my:hasRelationWith ?target_obj}
minus {?target_obj my:hasRelationWith ?src_obj}
}
You can query about what's logically provable. That means that if you can infer that some individual isn't related to any others by some property, you can ask about it. For instance, if you have disjoint classes Cat and Dog, so that nothing can be an instance of both, and you have a Person jim who also has the additional type hasPet only Cat and Dog, then a reasoner can infer that jim hasPet exactly 0.
In the DL query language, you can also use inverse properties. The previous example showed that jim has no pets (i.e., is an instance of hasPet exactly 0). You could ask for animals that aren't the pets of anyone by asking for instances of inverse hasPet exactly 0. For instance, if you add disjoint subclasses of Person, ThisKind and ThatKind, and say that missy the Cat inverse hasPet only ThisKind and ThatKind, then a reasoner can infer that no one is related to missy by the hasPet property. An ontology for these two examples is given at the end of this answer.
For your particular query, you just combine two class expressions of the forms I've just described:
hasRelationWith exactly 0 and inverse hasRelationWith exactly 0
or, with some parenthesis:
(hasRelationWith exactly 0) and ((inverse hasRelationWith) exactly 0)
It is very important to note, however, that this only returns individuals for which it can be proven that there are no such relations. It's not enough for the data to simply not contain such relations yet. OWL makes the open world assumption, meaning something that isn't explicitly stated or provable isn't assumed to be true or false.
Example ontology
#prefix : <http://www.example.org/cardinality-example#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:fido a owl:NamedIndividual , :Dog .
:Dog a owl:Class .
:fluffy a owl:NamedIndividual , :Cat ;
a [ a owl:Class ;
owl:intersectionOf ( :ThatKind [ a owl:Restriction ;
owl:allValuesFrom :ThisKind ;
owl:onProperty [ owl:inverseOf :hasPet ]
] )
] .
:ThatKind a owl:Class ;
rdfs:subClassOf :Person ;
owl:disjointWith :ThisKind .
:rover a owl:NamedIndividual , :Dog .
:hasPet a owl:ObjectProperty .
<http://www.example.org/cardinality-example>
a owl:Ontology .
:Person a owl:Class .
:jim a owl:NamedIndividual , :Person ;
a [ a owl:Restriction ;
owl:cardinality "0"^^xsd:nonNegativeInteger ;
owl:onProperty :hasPet
] .
:missy a owl:NamedIndividual , :Cat .
:Cat a owl:Class ;
owl:disjointWith :Dog .
:ThisKind a owl:Class ;
rdfs:subClassOf :Person .

ontology mapping (pointing) to columns and rows in mysql Database

I am a beginner in ontology domain.I have a simple question which I could not find it anywhere!
I have made my ontology in Protege,I have conceptualized my domain of interest(Energy consumption in a production line) and now I need to have access to the data which are stored in my database via this ontology.I do not want to store any data in my ontology but need to have access to data in database via my ontology.I am totally unaware of its possibility,if it is possible which tools I have to use for this purpose? Should I write for example a code in Java or ...
Thank you so much in advance
If you have a database with data in it and an ontology that represents a conceptualization of those data, you can establish a mapping and expose those data as if they were represented according to your conceptualization by writing mappings for D2RQ.
An example taken from the documentation:
# D2RQ Namespace
#prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
# Namespace of the ontology
#prefix : <http://annotation.semanticweb.org/iswc/iswc.daml#> .
# Namespace of the mapping file; does not appear in mapped data
#prefix map: <file:///Users/d2r/example.ttl#> .
# Other namespaces
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
map:Database1 a d2rq:Database;
d2rq:jdbcDSN "jdbc:mysql://localhost/iswc";
d2rq:jdbcDriver "com.mysql.jdbc.Driver";
d2rq:username "user";
d2rq:password "password";
.
# -----------------------------------------------
# CREATE TABLE Conferences (ConfID int, Name text, Location text);
map:Conference a d2rq:ClassMap;
d2rq:dataStorage map:Database1;
d2rq:class :Conference;
d2rq:uriPattern "http://conferences.org/comp/confno##Conferences.ConfID##";
.
map:eventTitle a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Conference;
d2rq:property :eventTitle;
d2rq:column "Conferences.Name";
d2rq:datatype xsd:string;
.
map:location a d2rq:PropertyBridge;
d2rq:belongsToClassMap map:Conference;
d2rq:property :location;
d2rq:column "Conferences.Location";
d2rq:datatype xsd:string;
.
Example page
D2R website and documentation

Resources