public class CategorizationModule extends java.lang.Object implements IServiceProvider
+-------+ | Thing | .'+-------._ .-' ``-._ +----.'----+ +-----`-------+ | Artifact | | WhiteObject | +--.-----.-+ +------+--,---+ / `-. / \ +---.'---+ +`-.--+ | \ | Animal | | Car | / \ +----+---+ +-----+ | | \ `. / '. \ `-. | | +-----+-------+ +---`------+ | | WhiteAnimal | | WhiteCar | | +-------------+ +----------+ / `'--...__ ,' ``---........,-'If you're looking for the similarities between concepts WhiteAnimal and WhiteCar, the
getSimilarities(OntResource, OntResource)
method would
return the set {Artifact, WhiteObject}, ie the set of classes that belong to
the intersection of the super-classes of both the concepts and without sub-
classes in this intersection (the common ancestors).
On the contrary, the getDifferences(OntResource, OntResource)
method
returns {Animal, Car} and {WhiteAnimal, WhiteCar}, ie the direct subclasses
of the common ancestors that belongs to the hierarchies of the compared
concepts.
We want S2 such as: S1 = superclasses(A) ∩ superclasses(B) S2 = { c / c ∈ S1 AND subclasses(c) ∩ S1 = ∅ }In the example above, S2 = {Artifact, WhiteObject}
We want S3 such as: S3 = ∪ { c / c ∈ S2, (directsubclasses(c) ∩ superclasses(A)) ∪ (directsubclasses(c) ∩ superclasses(B)) }In the example above, S3 = {{Animal, Car}, {WhiteAnimal, WhiteCar}} The
getDifferences(OntResource, OntResource)
method would actually
return a set of sets of statements, sorting by parent types the values for
the two concepts (for instance, [[a type Animal, b type Car], [a type
WhiteAnimal, b type WhiteCar]]
).
getSimilarities(OntResource, OntResource)
method will return as
well the list of properties that are shared with the same object by both the
concepts.
The getDifferences(OntResource, OntResource)
returns on the contrary
properties shared by both concept but with different objects.Constructor and Description |
---|
CategorizationModule(IOntologyBackend oro) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.util.Set<java.lang.String>> |
discriminate(java.util.Set<java.lang.String> rawConcepts) |
java.util.Set<java.util.Set<java.lang.String>> |
getDifferences(com.hp.hpl.jena.ontology.OntResource conceptA,
com.hp.hpl.jena.ontology.OntResource conceptB)
Returns the computed differences between two concepts, relying on
asserted and inferred fact in the ontology.
|
java.util.Set<java.util.Set<java.lang.String>> |
getDifferences(java.lang.String conceptA,
java.lang.String conceptB)
Returns the differences between two concepts (in their literal
representation).
|
java.util.List<java.util.Set<com.hp.hpl.jena.rdf.model.Property>> |
getDiscriminent(java.util.Set<com.hp.hpl.jena.ontology.OntResource> individuals)
Returns a list of properties that helps to differentiate individuals.
|
java.util.Set<java.lang.String> |
getSimilarities(com.hp.hpl.jena.ontology.OntResource conceptA,
com.hp.hpl.jena.ontology.OntResource conceptB)
Returns the computed similarities between two concepts, relying on
asserted and inferred fact in the ontology.
|
java.util.Set<java.lang.String> |
getSimilarities(java.lang.String conceptA,
java.lang.String conceptB)
Returns the similarities between two concepts (in their literal
representation).
|
java.util.Map<com.hp.hpl.jena.ontology.OntClass,java.util.Set<com.hp.hpl.jena.ontology.Individual>> |
makeCategories(java.util.Set<com.hp.hpl.jena.ontology.OntResource> resources)
Try to build a categories from a set of individuals.
|
public CategorizationModule(IOntologyBackend oro)
public java.util.Set<java.util.Set<java.lang.String>> getDifferences(com.hp.hpl.jena.ontology.OntResource conceptA, com.hp.hpl.jena.ontology.OntResource conceptB) throws NotComparableException
conceptA
- First concept to compareconceptB
- Second concept to compare[[a type Animal, b type Car], [a type WhiteAnimal, b
type WhiteCar]]
)NotComparableException
Detailled explanations with a diagram.
,
Same "stringified" method.
@RPCMethod(category="concept comparison", desc="given two concepts, return the list of relevant differences (types, properties...) between these concepts.") public java.util.Set<java.util.Set<java.lang.String>> getDifferences(java.lang.String conceptA, java.lang.String conceptB) throws com.hp.hpl.jena.shared.NotFoundException, NotComparableException
conceptA
- The first concept to compareconceptB
- The second concept to comparecom.hp.hpl.jena.shared.NotFoundException
NotComparableException
Detailled explanations with a diagram.
,
getDifferences(OntResource, OntResource)
public java.util.List<java.util.Set<com.hp.hpl.jena.rdf.model.Property>> getDiscriminent(java.util.Set<com.hp.hpl.jena.ontology.OntResource> individuals) throws NotComparableException
+-------+ | Thing | +--,'.--+ .-' `-. ,' `. ,' `-. .-' `. +----+--+ +--+-----+ | Plant | | Animal | +---+---+ +--+++---+ | _,-" | `--.._ | .-' | ``--.. plant1 animal1 animal2 animal3 | | / `. \ | | / `-. \ hasColor eats eats hasColor hasColor | | | | | | | | | | green banana grass blue red
Let's imagine the robot wants to answer an ambigious order like
Give me the thing!: we need a way to disambiguate the different
possible individuals in the Thing
class.
The method return two things:
The method proceeds as follows:
p1 p2 p3 ------------------------------------- plant1: {hasClass, hasColor} animal1: {hasClass, eats} animal2: {hasClass, hasColor, eats} animal3: {hasClass, hasColor} ------------------------------------- |p|= 4 3 2
| p1:hasClass | p2:hasColor | p3:eats ---------+-------------+-------------+-------- plant1 | Plant | green | animal1 | Animal | | banana animal2 | Animal | blue | grass animal3 | Animal | red | ---------+-------------+-------------+-------- |≠ elem.|= 2 3 2
hasClass
.
If we apply the method to the instances of the Animal
class, it
would return {hasColor, eats}
.
It should be noted that this way of proceeding doesn't respect the OWL
open world assumption: in OWA, the animal2 and the animal3 could possibly
eat bananas as well, and thus, the eats
property isn't selective.
This rule is not enforced on purpose in this implementation: we stand on
the viewpoint of a human-robot interaction where a robot only reason with
what he positively knows.
individuals
- A set of conceptsNotComparableException
@RPCMethod(category="concept comparison", desc="returns a list of properties that helps to differentiate individuals.") public java.util.List<java.util.Set<java.lang.String>> discriminate(java.util.Set<java.lang.String> rawConcepts) throws com.hp.hpl.jena.shared.NotFoundException, NotComparableException
com.hp.hpl.jena.shared.NotFoundException
NotComparableException
public java.util.Set<java.lang.String> getSimilarities(com.hp.hpl.jena.ontology.OntResource conceptA, com.hp.hpl.jena.ontology.OntResource conceptB) throws NotComparableException
conceptA
- First concept to compareconceptB
- Second concept to compareNotComparableException
Detailled explanations with a diagram.
,
Same "stringified" method.
@RPCMethod(category="concept comparison", desc="given two concepts, return the list of relevant similarities (types, properties...) between these concepts.") public java.util.Set<java.lang.String> getSimilarities(java.lang.String conceptA, java.lang.String conceptB) throws com.hp.hpl.jena.shared.NotFoundException, NotComparableException
conceptA
- The first concept to compareconceptB
- The second concept to comparecom.hp.hpl.jena.shared.NotFoundException
NotComparableException
Detailled explanations with a diagram.
,
getSimilarities(OntResource, OntResource)
public java.util.Map<com.hp.hpl.jena.ontology.OntClass,java.util.Set<com.hp.hpl.jena.ontology.Individual>> makeCategories(java.util.Set<com.hp.hpl.jena.ontology.OntResource> resources) throws NotComparableException
NotComparableException
ORO is a part of the OpenRobots framework.
openrobots@laas.fr
LAAS-CNRS 2009-2011