Package alps.java.api.parsing
Klasse ParsingTreeMatcher
java.lang.Object
alps.java.api.parsing.ParsingTreeMatcher
- Alle implementierten Schnittstellen:
IParsingTreeMatcher
This class creates trees for the owl class hierarchy and the c# class hierarchy dynamically at runtime.
Afterwards, the nodes in the trees are mapped together.
The mapping is used by the parser to instantiate owl class instances with c# class instances
-
Feldübersicht
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate void
addToParsingDict
(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, ITreeNode<IParseablePASSProcessModelElement> element, int depth) Adds mapped elements to the parsing dictionary.Creates the inheritance tree for the java classes known to this libraryprivate List<org.apache.jena.ontology.OntClass>
createOWLInheritanceTree
(org.apache.jena.ontology.OntModel parsingStructureOntologyGraph) Creates the inheritance tree for owl classes out of the given filesprivate void
createParsingStructureFromTrees
(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, ITreeNode<IParseablePASSProcessModelElement> rootNode) Creates a parsing dictionary containing Ontology urls as keys and instances of c# classes that can be used to parse the ontology classes.private void
private void
findClassesInDirectory
(Class<?> superclass, String packageName, File directory, List<Class<?>> subclasses) findSubclasses
(Class<?> superclass) getClassName
(Object object) private boolean
hasParentClass
(org.apache.jena.ontology.OntClass ontClass) Checks whether an Ontology class has a parent class or not (in the given graph)Map<String,
List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> loadOWLParsingStructure
(List<org.apache.jena.ontology.OntModel> owlStructureGraphs) Creates a dictionary that maps owl classes with c# classes.private void
mapRestWithParentNode
(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, String parentNodeKey, int depth, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) Do not use this directly, use:mapRestWithParentNode(Map, OntClass, String, ICompatibilityDictionary)
insteadprivate void
mapRestWithParentNode
(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, String parentNodeKey, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) This method maps all child classes of an owl class with the same java class.private boolean
matchesSchema
(String str) private void
parseChilds
(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass parentOntClass, ITreeNode<IParseablePASSProcessModelElement> parentNode, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) Tries to find Java-classes that can parse given urls of the ontology both structures (the ontology inheritance classes as well as the c# inheritance classes) are structured as a tree This method is called recursive.void
printClassHierarchy
(ITreeNode<IParseablePASSProcessModelElement> node, String indent) Method that outputs the Java class hierarchy tree for tree verification. -> java class hierarchy tree is correctprivate static String
Removes a base uri from a string if it is concathenated using #
-
Felddetails
-
i
public int i
-
-
Konstruktordetails
-
ParsingTreeMatcher
public ParsingTreeMatcher()
-
-
Methodendetails
-
loadOWLParsingStructure
public Map<String,List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> loadOWLParsingStructure (List<org.apache.jena.ontology.OntModel> owlStructureGraphs) Beschreibung aus Schnittstelle kopiert:IParsingTreeMatcher
Creates a dictionary that maps owl classes with c# classes. The owl classes are extracted from given class-defining owl files (i.e. the standard-pass-ont, abstract-pass-ont). The c# classes are evaluated dynamically at runtime from all classes known to this assembly.- Angegeben von:
loadOWLParsingStructure
in SchnittstelleIParsingTreeMatcher
-
matchesSchema
-
createOWLInheritanceTree
private List<org.apache.jena.ontology.OntClass> createOWLInheritanceTree(org.apache.jena.ontology.OntModel parsingStructureOntologyGraph) Creates the inheritance tree for owl classes out of the given files- Parameter:
parsingStructureOntologyGraph
-- Gibt zurück:
-
hasParentClass
private boolean hasParentClass(org.apache.jena.ontology.OntClass ontClass) Checks whether an Ontology class has a parent class or not (in the given graph)- Parameter:
ontClass
- the Ontology class- Gibt zurück:
- true if a parent class exists, false if not
-
createClassInheritanceTree
Creates the inheritance tree for the java classes known to this library- Gibt zurück:
-
findChildsAndAdd
-
findSubclasses
-
findClassesInDirectory
-
printClassHierarchy
Method that outputs the Java class hierarchy tree for tree verification. -> java class hierarchy tree is correct- Parameter:
node
-indent
- for better visualization just use "-".
-
getClassName
-
createParsingStructureFromTrees
private void createParsingStructureFromTrees(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, ITreeNode<IParseablePASSProcessModelElement> rootNode) Creates a parsing dictionary containing Ontology urls as keys and instances of c# classes that can be used to parse the ontology classes. If an ontlogy class cannot be parsed using any path through both trees (i.e. the trees differ in some places), this class and all its childs will be parsed using the last instance class where the trees did not differ.- Parameter:
ontClass
-rootNode
-
-
parseChilds
private void parseChilds(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass parentOntClass, ITreeNode<IParseablePASSProcessModelElement> parentNode, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) Tries to find Java-classes that can parse given urls of the ontology both structures (the ontology inheritance classes as well as the c# inheritance classes) are structured as a tree This method is called recursive. It tries to map each child of the given ontology parent class with one or more childs of the given c# parent class. It is asserted that the c# parent class was previously selected to be able to parse the ontology parent class (else this would make no sense) this algorithm is trying to map both tree structures together, containing the mapping inside a parsing dictionary. If a part of the Ontology tree cannot be mapped, the algorithm marks this url in another dict and does not try to map the childs of this element.- Parameter:
parsingDict
- Keeps all the valid mappings found down to the current classparentOntClass
- the parent Ontology class that can be parsed with the instance of IPASSProcessModelElement in the current parentNodeparentNode
- A node containing an instance representing a valid parsing class for the Ontology class given by parentOntClassunmappableDict
- A dict of elements that could not be mapped
-
addToParsingDict
private void addToParsingDict(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, ITreeNode<IParseablePASSProcessModelElement> element, int depth) Adds mapped elements to the parsing dictionary. If there exists a list for the given key, the value is being added to the existing list.- Parameter:
parsingDict
- the dictionary used for parsingontClass
- the Ontology class used (url as key)element
- the instance that can parse the ontology class (used as value)
-
mapRestWithParentNode
private void mapRestWithParentNode(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, String parentNodeKey, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) This method maps all child classes of an owl class with the same java class. If no specific c# class exists for an owl class, then the parser assumes that no specific java class exists for the children of the owl class exists as well. All owl classes that are more specific than the mappable parent will not have a c# equivalent, so they are all parsed by using the mapped parent java class.- Parameter:
parsingDict
- The parsing dictionaryontClass
- The ontology class that could not be mapped to a c# classparentNodeKey
- the node that was mapped with the parent ontology class of the ontClass
-
mapRestWithParentNode
private void mapRestWithParentNode(Map<String, List<org.apache.commons.lang3.tuple.Pair<ITreeNode<IParseablePASSProcessModelElement>, Integer>>> parsingDict, org.apache.jena.ontology.OntClass ontClass, String parentNodeKey, int depth, ICompatibilityDictionary<org.apache.jena.ontology.OntClass, String> unmappableDict) Do not use this directly, use:mapRestWithParentNode(Map, OntClass, String, ICompatibilityDictionary)
instead -
removeUri
Removes a base uri from a string if it is concathenated using #- Parameter:
stringWithUri
-- Gibt zurück:
-