Comments (7)
Hi @constnick,
I added two new methods in the Data object to fulfill the new use case:
- DeclareNegativeIndividualType: to explicitly state that the given individual is not of the given class
OWLOntology ontology = new OWLOntology("ex:ont");
ontology.Model.ClassModel.DeclareClass(new RDFResource("ex:Cls"));
ontology.Data.DeclareIndividual(new RDFResource("ex:Idv"));
ontology.Data.DeclareNegativeIndividualType(ontology.Model, new RDFResource("ex:Idv"), new RDFResource("ex:Cls"));
- CheckIsNegativeIndividualOf: to check if the given individual is explicitly not of the given class (which was your original question)
bool isNotIdvOfCls = ontology.Data.CheckIsNegativeIndividualOf(ontology.Model, new RDFResource("ex:Idv"), new RDFResource("ex:Cls"))
If this is desired, I'll release a new version with the code in the next few days.
Regards,
Marco
from owlsharp.
Hi constnick, given your individual I0 and your complement class C_C0, you can use:
bool isnotaC0 = myOntology.Data.CheckIsIndividualOf(myOntology.Model, I0, C_C0);
Regards,
Marco
from owlsharp.
It is checking for — is I0 explicitly belongs to C0 or not.
But I need to check, is I0 explicitly not belongs to C0.
For example in Turtle:
test:Man rdf:type owl:NamedIndividual ,
test:Human ,
[ rdf:type owl:Class ;
owl:complementOf test:Japanese
] .
It means that Man
is definitely known as not Japanese
.
I need to check if there is such a declaration in the ontology.
from owlsharp.
Hi,
although the library is answering your need, I understand that you have a slightly different semantic to prove. This kind of check must be done at SPARQL level, where you have full power of controlling the raw RDF triples of the knowledge in such way:
//Get down to RDF/SPARQL level
RDFGraph ontologyGraph = ontology.ToRDFGraph(true);
//Build an ASK query detecting individuals of any complement class, constraining the answer to the "test:Man" individual and the "test:Japanese" class to be targeted
//Maybe it is more verbose than needed, containing pattern which may be omitted, but I prefer to remain formal
RDFAskQuery isNotJapaneseQuery = new RDFAskQuery()
.AddPatternGroup(new RDFPatternGroup()
.AddPattern(new RDFPattern(new RDFVariable("?IDV"), RDFVocabulary.RDF.TYPE, RDFVocabulary.OWL.NAMED_INDIVIDUAL))
.AddPattern(new RDFPattern(new RDFVariable("?IDV"), RDFVocabulary.RDF.TYPE, new RDFVariable("?IDVCLS")))
.AddPattern(new RDFPattern(new RDFVariable("?IDVCLS"), RDFVocabulary.RDF.TYPE, RDFVocabulary.OWL.CLASS))
.AddPattern(new RDFPattern(new RDFVariable("?IDVCLS"), RDFVocabulary.OWL.COMPLEMENT_OF, new RDFVariable("?NOTIDVCLS")))
.AddFilter(new RDFSameTermFilter(new RDFVariable("?IDV"), new RDFResource("test:Man")))
.AddFilter(new RDFSameTermFilter(new RDFVariable("?NOTIDVCLS"), new RDFResource("test:Japanese"))));
RDFAskQueryResult isNotJapaneseQueryResult = isNotJapaneseQuery.ApplyToGraph(ontologyGraph);
Console.Write("test:Man IS NOT test:Japanese? " + isNotJapaneseQueryResult.AskResult);
Let me know if this fits yor needs.
Regards,
Marco
from owlsharp.
Yes, certainly I can do what I want with SPARQL, but it would be convenient to have such methods in an ontology object or its component.
By the way:
There are two kinds of "spo" or "spl" assertions: positive and negative.
And also there are the same two kinds of "type" statements.
For example, in Manchester syntax it expressed just with simple "not":
Individual: test:Man
Types:
test:Human,
not (test:Japanese)
May be it would be consistent to have symmetrical tools to work with negative "type" statements, just like with negative spo/spl assertions?
from owlsharp.
I didn't know the existence of the "negative type" statement. Maybe a OWL2 syntax which I didn't notice.
So, given an individual "ex:Idv" and a target class "ex:Cls" being the prohibited class, I'll figure how to add modeling support for this new construct:
ex:Idv rdf:type owl:NamedIndividual,
[ rdf:type owl:Class; owl:complementOf ex:Cls ] .
Regards,
Marco
from owlsharp.
Yes, I think that's what is needed, thanks!
from owlsharp.
Related Issues (20)
- Add support for writing OWL/XML syntax
- Add validator rule for checking owl:TopObjectProperty and owl:BottomObjectProperty consistency HOT 1
- Provide support for temporal reasoning HOT 1
- Reorganize internals to host SWRL as extension to the OWL core HOT 1
- SKOS extension should conform to our standard architecture (like SWRL, GEO and TIME)
- Provide support for SKOS reasoning HOT 1
- Complete SKOS validator with remaining rules
- Add support for temporal validation
- Add ability to import ontologies HOT 1
- Reasoner error? HOT 5
- Add reasoner rule for enhanced TBOX entailments
- Validation with cardinality restriction HOT 3
- Add ability to query an ontology with SPARQL
- Add support for modeling literal enumerate classes HOT 1
- Add support for exporting ontologies without including inferences
- Incorrect detection of OWL2-Full anonymous inline property expressions on restrictions
- Functional properties, SameAs inference, validation HOT 8
- Also provide reasoner rule for inverse functional entailment HOT 1
- Add validator rule for checking owl:Thing and owl:Nothing consistency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from owlsharp.