Class OntologyImpl
java.lang.Object
de.uni_trier.wi2.procake.utils.ontology.OntologyImpl
- All Implemented Interfaces:
Ontology
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Calculate the depth of an entity from the root.int
calculateDepthOfResource
(URIObject res, String root, Set<String> relations) int
calculateDepthOfResource
(org.apache.jena.rdf.model.Resource res) int
calculateDepthOfResource
(org.apache.jena.rdf.model.Resource res, String root) int
calculateDepthOfResource
(org.apache.jena.rdf.model.Resource res, String root, Set<String> relations) int
calculateDepthOfResource
(org.apache.jena.rdf.model.Resource res, org.apache.jena.rdf.model.Resource root) int
calculateDepthOfResource
(org.apache.jena.rdf.model.Resource target, org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) boolean
Check for the existence of the resource in the underlying ontology.boolean
Check for the existence of the resource in the underlying ontology.getAllChildrenForNode
(String rootNodeURI, Set<String> relations) Recursively collects all children for a given node which are connected via the given relation.Set<org.apache.jena.rdf.model.Resource>
getAllChildrenForNode
(org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) Set<org.apache.jena.rdf.model.Statement>
getAllPropertiesOfNode
(String nodeURI) Recursively collects all parents of the given node connected by minimally one relation in the given set of relations.Set<org.apache.jena.rdf.model.Resource>
getAncestors
(org.apache.jena.rdf.model.Resource node, Set<String> relations) Set<org.apache.jena.rdf.model.Resource>
getAncestors
(org.apache.jena.rdf.model.Resource node, Set<String> relations, Predicate<String> isValidTreeValuePredicate) Set<org.apache.jena.rdf.model.Resource>
getClassRoots
(org.apache.jena.rdf.model.Resource node) Determine the LCA(Least Common Ancestor) of two concepts.org.apache.jena.rdf.model.Resource
Determine the LCA (Least Common Ancestor) of to concepts.org.apache.jena.rdf.model.Resource
getLCA
(org.apache.jena.rdf.model.Resource queryRes, org.apache.jena.rdf.model.Resource caseRes) org.apache.jena.rdf.model.Resource
getLCA
(org.apache.jena.rdf.model.Resource first, org.apache.jena.rdf.model.Resource second, org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) int
getMaxDepthToLeaf
(String root, Set<String> relations) int
getMaxDepthToLeaf
(org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) org.apache.jena.rdf.model.Model
getModel()
List<org.apache.jena.rdf.model.RDFNode>
getObjectsOfProperty
(URIObject resourceURIObject, String property) Examine the given resource for the given property and collect its objects.List<org.apache.jena.rdf.model.RDFNode>
getObjectsOfProperty
(String resourceURI, String property) Examine the given resource for the given property and collect its objects.List<org.apache.jena.rdf.model.RDFNode>
getObjectsOfProperty
(org.apache.jena.rdf.model.Resource resource, String property) Examine the given resource for the given property and collect its objects.org.apache.jena.ontology.OntModel
org.apache.jena.rdf.model.Property
getProperty
(String propertyURI) Fetches the Property object with the given URI from the underlying Jena ontology model.org.apache.jena.rdf.model.Resource
getResource
(URIObject resourceURIObject) Fetches the Resource object with the given URI from the underlying Jena ontology model.org.apache.jena.rdf.model.Resource
getResource
(String resourceURI) Fetches the Resource object with the given URI from the underlying Jena ontology model.int
getShortestPathLength
(URIObject source, URIObject destination, String propName) Calculate the shortest path from on entity to another over a specific relation and return its length.int
getShortestPathLength
(URIObject source, URIObject destination, Set<String> relations) int
getShortestPathLength
(org.apache.jena.rdf.model.Resource source, org.apache.jena.rdf.model.Resource destination, String propName) int
getShortestPathLength
(org.apache.jena.rdf.model.Resource source, org.apache.jena.rdf.model.Resource destination, Set<String> props) org.apache.jena.rdf.model.Resource
getUniqueLCA
(HashSet<org.apache.jena.rdf.model.Resource> tempResources, org.apache.jena.rdf.model.Resource resA, org.apache.jena.rdf.model.Resource resB) Determine the Unique LCA.void
init
(org.apache.jena.ontology.OntModel ontModel) boolean
isIndividual
(URIObject res) Check if entity is an Individual.boolean
isIndividual
(org.apache.jena.rdf.model.Resource res) Check whether entity is an Individual.boolean
isSubClassOfProperty
(String relation) Check whether the given relation is a rdfs subclass property.boolean
isTypeProperty
(String relation) Check whether the given relation is a rdf type property.org.apache.jena.query.ResultSet
org.apache.jena.query.ResultSet
void
registerPredicate
(InstanceOntologyOrderPredicate predicate)
-
Constructor Details
-
OntologyImpl
public OntologyImpl(org.apache.jena.ontology.OntModel ontModel)
-
-
Method Details
-
init
public void init(org.apache.jena.ontology.OntModel ontModel) -
registerPredicate
-
isIndividual
Check if entity is an Individual.- Specified by:
isIndividual
in interfaceOntology
- Parameters:
res
- the entity.- Returns:
- if it is an Individual.
-
isIndividual
public boolean isIndividual(org.apache.jena.rdf.model.Resource res) Description copied from interface:Ontology
Check whether entity is an Individual.- Specified by:
isIndividual
in interfaceOntology
- Parameters:
res
- the entity.- Returns:
- whether it is an Individual.
-
getLCA
Determine the LCA(Least Common Ancestor) of two concepts. -
getLCA
-
getLCA
public org.apache.jena.rdf.model.Resource getLCA(String first, String second, String root, Set<String> relations) Description copied from interface:Ontology
Determine the LCA (Least Common Ancestor) of to concepts. -
getLCA
public org.apache.jena.rdf.model.Resource getLCA(org.apache.jena.rdf.model.Resource queryRes, org.apache.jena.rdf.model.Resource caseRes) -
getLCA
public org.apache.jena.rdf.model.Resource getLCA(org.apache.jena.rdf.model.Resource first, org.apache.jena.rdf.model.Resource second, org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) -
getUniqueLCA
public org.apache.jena.rdf.model.Resource getUniqueLCA(HashSet<org.apache.jena.rdf.model.Resource> tempResources, org.apache.jena.rdf.model.Resource resA, org.apache.jena.rdf.model.Resource resB) Determine the Unique LCA. It is either the most specific or the one with the smallest distance to the entities.- Parameters:
tempResources
- the possible LCAs.resA
- the first entity.resB
- the second entity- Returns:
- the unique LCA.
-
calculateDepthOfResource
Calculate the depth of an entity from the root.- Specified by:
calculateDepthOfResource
in interfaceOntology
- Parameters:
res
- the entity.- Returns:
- the depth of the entity from the root.
-
calculateDepthOfResource
- Specified by:
calculateDepthOfResource
in interfaceOntology
-
calculateDepthOfResource
public int calculateDepthOfResource(org.apache.jena.rdf.model.Resource res) - Specified by:
calculateDepthOfResource
in interfaceOntology
-
calculateDepthOfResource
public int calculateDepthOfResource(org.apache.jena.rdf.model.Resource res, org.apache.jena.rdf.model.Resource root) - Specified by:
calculateDepthOfResource
in interfaceOntology
-
calculateDepthOfResource
- Specified by:
calculateDepthOfResource
in interfaceOntology
-
calculateDepthOfResource
public int calculateDepthOfResource(org.apache.jena.rdf.model.Resource res, String root, Set<String> relations) - Specified by:
calculateDepthOfResource
in interfaceOntology
-
calculateDepthOfResource
public int calculateDepthOfResource(org.apache.jena.rdf.model.Resource target, org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) -
getShortestPathLength
Calculate the shortest path from on entity to another over a specific relation and return its length.- Specified by:
getShortestPathLength
in interfaceOntology
- Parameters:
source
- the first entity.destination
- the second entity.propName
- the specific relation.- Returns:
- the length of the shortest path.
-
getShortestPathLength
- Specified by:
getShortestPathLength
in interfaceOntology
-
getShortestPathLength
public int getShortestPathLength(org.apache.jena.rdf.model.Resource source, org.apache.jena.rdf.model.Resource destination, String propName) -
getShortestPathLength
-
getAncestors
public Set<String> getAncestors(URIObject res, Set<String> relations, Predicate<String> isValidTreeValuePredicate) Description copied from interface:Ontology
Recursively collects all parents of the given node connected by minimally one relation in the given set of relations. Is the given node an individual, the classes of the individuals are determined and their parents are collected- Specified by:
getAncestors
in interfaceOntology
- Returns:
-
getAncestors
-
getAncestors
-
contains
Description copied from interface:Ontology
Check for the existence of the resource in the underlying ontology. -
contains
Description copied from interface:Ontology
Check for the existence of the resource in the underlying ontology. -
getAllPropertiesOfNode
- Specified by:
getAllPropertiesOfNode
in interfaceOntology
- Parameters:
nodeURI
- node whose properties should be collected- Returns:
- set of all properties
-
query
-
query
-
getAllChildrenForNode
Description copied from interface:Ontology
Recursively collects all children for a given node which are connected via the given relation.- Specified by:
getAllChildrenForNode
in interfaceOntology
- Parameters:
rootNodeURI
- the node whose children should be collected.relations
- the relation that is considered during the search.- Returns:
- a set of all children.
-
getAllChildrenForNode
-
getClassRoots
public Set<org.apache.jena.rdf.model.Resource> getClassRoots(org.apache.jena.rdf.model.Resource node) -
getMaxDepthToLeaf
- Specified by:
getMaxDepthToLeaf
in interfaceOntology
-
getMaxDepthToLeaf
public int getMaxDepthToLeaf(org.apache.jena.rdf.model.Resource root, Set<org.apache.jena.rdf.model.Property> relations) -
getObjectsOfProperty
public List<org.apache.jena.rdf.model.RDFNode> getObjectsOfProperty(org.apache.jena.rdf.model.Resource resource, String property) Description copied from interface:Ontology
Examine the given resource for the given property and collect its objects.- Specified by:
getObjectsOfProperty
in interfaceOntology
- Parameters:
resource
- the resource that will be examined.property
- the property that will be looked for.- Returns:
- a list of all nodes representing the object of the predicate that is represented by the given property.
-
getObjectsOfProperty
public List<org.apache.jena.rdf.model.RDFNode> getObjectsOfProperty(String resourceURI, String property) Description copied from interface:Ontology
Examine the given resource for the given property and collect its objects.- Specified by:
getObjectsOfProperty
in interfaceOntology
- Parameters:
resourceURI
- the resource that will be examined.property
- the property that will be looked for.- Returns:
- a list of all nodes representing the object of the predicate that is represented by the given property.
-
getObjectsOfProperty
public List<org.apache.jena.rdf.model.RDFNode> getObjectsOfProperty(URIObject resourceURIObject, String property) Description copied from interface:Ontology
Examine the given resource for the given property and collect its objects.- Specified by:
getObjectsOfProperty
in interfaceOntology
- Parameters:
resourceURIObject
- the resource that will be examined.property
- the property that will be looked for.- Returns:
- a list of all nodes representing the object of the predicate that is represented by the given property.
-
isSubClassOfProperty
Description copied from interface:Ontology
Check whether the given relation is a rdfs subclass property.- Specified by:
isSubClassOfProperty
in interfaceOntology
-
isTypeProperty
Description copied from interface:Ontology
Check whether the given relation is a rdf type property.- Specified by:
isTypeProperty
in interfaceOntology
-
getResource
Description copied from interface:Ontology
Fetches the Resource object with the given URI from the underlying Jena ontology model.- Specified by:
getResource
in interfaceOntology
- Parameters:
resourceURIObject
- the URI for which the Resource object should be fetched.- Returns:
- the desired Resource object.
-
getResource
Description copied from interface:Ontology
Fetches the Resource object with the given URI from the underlying Jena ontology model.- Specified by:
getResource
in interfaceOntology
- Parameters:
resourceURI
- the URI for which the Resource object should be fetched.- Returns:
- the desired Resource object.
-
getProperty
Description copied from interface:Ontology
Fetches the Property object with the given URI from the underlying Jena ontology model.- Specified by:
getProperty
in interfaceOntology
- Parameters:
propertyURI
- the URI for which the Property object should be fetched.- Returns:
- the desired Property object.
-
getModel
public org.apache.jena.rdf.model.Model getModel() -
getOntModel
public org.apache.jena.ontology.OntModel getOntModel()
-