@Deprecated // test only public int edgeSetSize() { return objectPropertyDAG.edgeSetSize() + dataPropertyDAG.edgeSetSize() + classDAG.edgeSetSize(); }
@Deprecated // test only public DefaultDirectedGraph<ObjectPropertyExpression,DefaultEdge> getObjectPropertyGraph() { return objectPropertyDAG.getGraph(); }
public static <T> EquivalencesDAGImpl<T> reduce(EquivalencesDAGImpl<T> source, SimpleDirectedGraph <Equivalences<T>,DefaultEdge> target) { ImmutableMap.Builder<T, Equivalences<T>> vertexIndexBuilder = new ImmutableMap.Builder<>(); for (Equivalences<T> tSet : target.vertexSet()) { for (T s : source.getVertex(tSet.getRepresentative())) if (tSet.contains(s)) vertexIndexBuilder.put(s, tSet); } ImmutableMap<T, Equivalences<T>> vertexIndex = vertexIndexBuilder.build(); // create induced edges in the target graph for (Equivalences<T> sSet : source) { Equivalences<T> tSet = vertexIndex.get(sSet.getRepresentative()); for (Equivalences<T> sSetSub : source.getDirectSub(sSet)) { Equivalences<T> tSetSub = vertexIndex.get(sSetSub.getRepresentative()); target.addEdge(tSetSub, tSet); } } return new EquivalencesDAGImpl<>(null, target, vertexIndex, source.vertexIndex); }
EquivalencesDAGImpl<ObjectPropertyExpression> objectPropertyDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<ObjectPropertyExpression>)reasoner.objectPropertiesDAG(), objectProperties); EquivalencesDAGImpl<DataPropertyExpression> dataPropertyDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<DataPropertyExpression>)reasoner.dataPropertiesDAG(), dataProperties); if (objectPropertyDAG.getVertex(((ObjectSomeValuesFrom) equi).getProperty()) != null) reduced.add(equi); if (dataPropertyDAG.getVertex(((DataSomeValuesFrom) equi).getProperty()) != null) reduced.add(equi); EquivalencesDAGImpl<ClassExpression> classDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<ClassExpression>)reasoner.classesDAG(), classes);
@Deprecated // test only public int vertexSetSize() { return objectPropertyDAG.vertexSetSize() + dataPropertyDAG.vertexSetSize() + classDAG.vertexSetSize(); }
private static void chooseObjectPropertyRepresentatives(EquivalencesDAGImpl<ObjectPropertyExpression> dag) { for (Equivalences<ObjectPropertyExpression> set : dag) { // skip if has already been done if (set.getRepresentative() != null) continue; ObjectPropertyExpression rep = Collections.min(set.getMembers(), objectPropertyComparator); ObjectPropertyExpression repInv = rep.getInverse(); Equivalences<ObjectPropertyExpression> setInv = dag.getVertex(repInv); if (rep.isInverse()) { repInv = Collections.min(setInv.getMembers(), objectPropertyComparator); rep = repInv.getInverse(); setInv.setIndexed(); } else set.setIndexed(); set.setRepresentative(rep); if (!set.contains(repInv)) { // if not symmetric // (each set either consists of symmetric properties // or none of the properties in the set is symmetric) setInv.setRepresentative(repInv); } } }
getObjectPropertyGraph(onto); EquivalencesDAGImpl<ObjectPropertyExpression> objectPropertyDAG = EquivalencesDAGImpl.getEquivalencesDAG(objectPropertyGraph); EquivalencesDAGImpl.getEquivalencesDAG(dataPropertyGraph); EquivalencesDAGImpl.getEquivalencesDAG(getClassGraph(onto, objectPropertyGraph, dataPropertyGraph)); EquivalencesDAGImpl.getEquivalencesDAG(getDataRangeGraph(onto, dataPropertyGraph));
return new EquivalencesDAGImpl<>(graph, dag, vertexIndex, vertexIndex);
public static <T> EquivalencesDAGImpl<T> reduce(EquivalencesDAGImpl<T> source, SimpleDirectedGraph <Equivalences<T>,DefaultEdge> target) { ImmutableMap.Builder<T, Equivalences<T>> vertexIndexBuilder = new ImmutableMap.Builder<>(); for (Equivalences<T> tSet : target.vertexSet()) { for (T s : source.getVertex(tSet.getRepresentative())) if (tSet.contains(s)) vertexIndexBuilder.put(s, tSet); } ImmutableMap<T, Equivalences<T>> vertexIndex = vertexIndexBuilder.build(); // create induced edges in the target graph for (Equivalences<T> sSet : source) { Equivalences<T> tSet = vertexIndex.get(sSet.getRepresentative()); for (Equivalences<T> sSetSub : source.getDirectSub(sSet)) { Equivalences<T> tSetSub = vertexIndex.get(sSetSub.getRepresentative()); target.addEdge(tSetSub, tSet); } } return new EquivalencesDAGImpl<>(null, target, vertexIndex, source.vertexIndex); }
EquivalencesDAGImpl<ObjectPropertyExpression> objectPropertyDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<ObjectPropertyExpression>)reasoner.objectPropertiesDAG(), objectProperties); EquivalencesDAGImpl<DataPropertyExpression> dataPropertyDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<DataPropertyExpression>)reasoner.dataPropertiesDAG(), dataProperties); if (objectPropertyDAG.getVertex(((ObjectSomeValuesFrom) equi).getProperty()) != null) reduced.add(equi); if (dataPropertyDAG.getVertex(((DataSomeValuesFrom) equi).getProperty()) != null) reduced.add(equi); EquivalencesDAGImpl<ClassExpression> classDAG = EquivalencesDAGImpl.reduce( (EquivalencesDAGImpl<ClassExpression>)reasoner.classesDAG(), classes);
@Deprecated // test only public int vertexSetSize() { return objectPropertyDAG.vertexSetSize() + dataPropertyDAG.vertexSetSize() + classDAG.vertexSetSize(); }
private static void chooseObjectPropertyRepresentatives(EquivalencesDAGImpl<ObjectPropertyExpression> dag) { for (Equivalences<ObjectPropertyExpression> set : dag) { // skip if has already been done if (set.getRepresentative() != null) continue; ObjectPropertyExpression rep = Collections.min(set.getMembers(), objectPropertyComparator); ObjectPropertyExpression repInv = rep.getInverse(); Equivalences<ObjectPropertyExpression> setInv = dag.getVertex(repInv); if (rep.isInverse()) { repInv = Collections.min(setInv.getMembers(), objectPropertyComparator); rep = repInv.getInverse(); setInv.setIndexed(); } else set.setIndexed(); set.setRepresentative(rep); if (!set.contains(repInv)) { // if not symmetric // (each set either consists of symmetric properties // or none of the properties in the set is symmetric) setInv.setRepresentative(repInv); } } }
getObjectPropertyGraph(onto); EquivalencesDAGImpl<ObjectPropertyExpression> objectPropertyDAG = EquivalencesDAGImpl.getEquivalencesDAG(objectPropertyGraph); EquivalencesDAGImpl.getEquivalencesDAG(dataPropertyGraph); EquivalencesDAGImpl.getEquivalencesDAG(getClassGraph(onto, objectPropertyGraph, dataPropertyGraph)); EquivalencesDAGImpl.getEquivalencesDAG(getDataRangeGraph(onto, dataPropertyGraph));
return new EquivalencesDAGImpl<>(graph, dag, vertexIndex, vertexIndex);
@Deprecated // test only public DefaultDirectedGraph<ClassExpression,DefaultEdge> getClassGraph() { return classDAG.getGraph(); }
@Deprecated // test only public int edgeSetSize() { return objectPropertyDAG.edgeSetSize() + dataPropertyDAG.edgeSetSize() + classDAG.edgeSetSize(); }
@Deprecated // test only public DefaultDirectedGraph<DataRangeExpression,DefaultEdge> getDataRangeGraph() { return dataRangeDAG.getGraph(); }
@Deprecated // test only public DefaultDirectedGraph<DataRangeExpression,DefaultEdge> getDataRangeGraph() { return dataRangeDAG.getGraph(); }