OWLGraphWrapperEdgesExtended extends OWLGraphWrapperEdges { public boolean hasFirstEdgeMoreGeneralGCIParams(OWLGraphEdge firstEdge, OWLGraphEdge otherEdge) { if (firstEdge == null || otherEdge == null) return false; if (firstEdge.equalsGCI(otherEdge)) return false; if (!firstEdge.isGCI()) return true; if (!otherEdge.isGCI()) return false; if (firstEdge.getGCIFiller() == null || firstEdge.getGCIRelation() == null || otherEdge.getGCIFiller() == null || otherEdge.getGCIRelation() == null) throw new AssertionError("GCI parameters of the compared edges cannot be null " + "at this point. First edge: " + firstEdge + " - Other edge: " + otherEdge); if (firstEdge.getGCIFiller().equals(otherEdge.getGCIFiller()) && firstEdge.getGCIRelation().equals(otherEdge.getGCIRelation())) throw new AssertionError("GCI fillers and relations of the compared edges " + "cannot be both equal at this point. First edge: " + firstEdge + " - Other edge: " + otherEdge); if (!firstEdge.getGCIRelation().equals(otherEdge.getGCIRelation()) && !this.getSuperPropertyClosureOf(otherEdge.getGCIRelation()).contains( firstEdge.getGCIRelation())) return false; if (!firstEdge.getGCIFiller().equals(otherEdge.getGCIFiller()) && !this.getAncestorsThroughIsA(otherEdge.getGCIFiller()).contains( firstEdge.getGCIFiller())) return false; return true; } OWLGraphWrapperEdgesExtended(OWLOntology ontology); protected  OWLGraphWrapperEdgesExtended(String iri); boolean isOWLObjectInSubsets(OWLObject testObject, Collection<String> subsets); Set<OWLAnnotationProperty> getSubAnnotationPropertiesOf(
            OWLAnnotationProperty prop); LinkedHashSet<OWLAnnotationProperty> getSubAnnotationPropertyClosureOf(
            OWLAnnotationProperty prop); LinkedHashSet<OWLAnnotationProperty> getSubAnnotationPropertyReflexiveClosureOf(
            OWLAnnotationProperty prop); Set<OWLObjectPropertyExpression> getSubPropertiesOf(
			OWLObjectPropertyExpression prop); LinkedHashSet<OWLObjectPropertyExpression> getSubPropertyClosureOf(
			OWLObjectPropertyExpression prop); LinkedHashSet<OWLObjectPropertyExpression> getSubPropertyReflexiveClosureOf(
			OWLObjectPropertyExpression prop); LinkedHashSet<OWLObjectPropertyExpression> getSuperPropertyReflexiveClosureOf(
    		OWLObjectPropertyExpression prop); LinkedHashSet<OWLGraphEdge> getOWLGraphEdgeSubRelsReflexive(OWLGraphEdge edge); OWLGraphEdge combineEdgePairWithSuperPropsAndGCI(OWLGraphEdge firstEdge, 
    		OWLGraphEdge secondEdge); Set<OWLGraphEdge> getOutgoingEdgesNamedClosureOverSupProps(OWLObject s); Set<OWLGraphEdge> getOutgoingEdgesNamedClosureOverSupPropsWithGCI(OWLObject s); Set<OWLGraphEdge> getOutgoingEdgesClosureWithGCI(OWLObject s); Set<OWLGraphEdge> getGCIOutgoingEdges(OWLClass s); Set<OWLGraphEdge> getGCIOutgoingEdges(OWLClass s, 
            Set<OWLPropertyExpression> overProps); Set<OWLGraphEdge> getGCIIncomingEdges(OWLClass t); Set<OWLGraphEdge> getOutgoingEdgesWithGCI(OWLObject s); Set<OWLGraphEdge> getOutgoingEdgesWithGCI(OWLObject s, 
            Set<OWLPropertyExpression> overProperties); Set<OWLGraphEdge> getIncomingEdgesWithGCI(OWLObject t); Set<OWLNamedObject> getNamedAncestorsWithGCI(OWLObject sourceObject); Set<OWLNamedObject> getNamedAncestorsWithGCI(OWLObject sourceObject, 
            @SuppressWarnings("rawtypes") Set<OWLPropertyExpression> overProps); Set<OWLClass> getOWLClassAncestorsWithGCI(OWLObject sourceObject); Set<OWLClass> getOWLClassDirectDescendantsWithGCI(OWLClass parentClass); Set<OWLClass> getOWLClassDescendantsWithGCI(OWLClass parentClass); Set<OWLClass> getOWLClassDescendantsWithGCI(OWLClass parentClass, 
            @SuppressWarnings("rawtypes") Set<OWLPropertyExpression> overProps); OWLGraphEdge combineEdgePairWithGCI(OWLObject s, OWLGraphEdge ne, 
            OWLGraphEdge extEdge, int nextDist); boolean hasFirstEdgeMoreGeneralGCIParams(OWLGraphEdge firstEdge, 
            OWLGraphEdge otherEdge); Set<OWLClass> getAncestorsThroughIsA(OWLObject x); Set<OWLClass> getDescendantsThroughIsA(OWLObject x); @Override void clearCachedEdges(); OWLObject edgeToSourceExpression(OWLGraphEdge e); Set<OWLClass> getAllRealOWLClasses(); Set<OWLClass> getAllRealOWLClassesFromSource(); Set<OWLClass> getOntologyRoots(); Set<OWLClass> getOntologyRoots(Set<OWLPropertyExpression> overProperties); Set<OWLClass> getOntologyLeaves(); Set<OWLClass> getOWLClassDescendants(OWLClass parentClass); Set<OWLClass> getOWLClassDirectDescendants(OWLClass parentClass); Set<OWLClass> getOWLClassDirectAncestors(OWLClass subClass); Set<OWLClass> getOWLClassAncestors(OWLClass sourceClass); boolean isRealClass(OWLObject object);  }
@Test public void testHasFirstEdgeMoreGeneralGCIParams() throws OWLOntologyCreationException, IOException { ParserWrapper parserWrapper = new ParserWrapper(); OWLOntology ont = parserWrapper.parse(OWLGraphWrapperEdgesExtendedTest.class.getResource( "/graph/gciRelRetrieval.obo").getFile()); OWLGraphWrapper wrapper = new OWLGraphWrapper(ont); OWLObjectProperty overlaps = wrapper.getOWLObjectPropertyByIdentifier("RO:0002131"); OWLObjectProperty partOf = wrapper.getOWLObjectPropertyByIdentifier("BFO:0000050"); OWLObjectProperty developsFrom = wrapper.getOWLObjectPropertyByIdentifier("RO:0002202"); OWLClass source = wrapper.getOWLClassByIdentifier("ID:2"); OWLClass target = wrapper.getOWLClassByIdentifier("ID:1"); OWLClass rootTaxon = wrapper.getOWLClassByIdentifier("NCBITaxon:1"); OWLClass taxon1 = wrapper.getOWLClassByIdentifier("NCBITaxon:9606"); OWLClass taxon2 = wrapper.getOWLClassByIdentifier("NCBITaxon:10090"); OWLGraphEdge edge1 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, taxon1, partOf); OWLGraphEdge edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, taxon1, partOf); assertFalse("Equal GCI parameters seen as more general", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertFalse("Equal GCI parameters seen as more general", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge1 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, null, null); edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, null, null); assertFalse("Equal GCI parameters seen as more general", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertFalse("Equal GCI parameters seen as more general", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge1 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, taxon1, partOf); edge2 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, taxon2, partOf); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge1 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, taxon1, partOf); edge2 = new OWLGraphEdge(source, target, null, Quantifier.SUBCLASS_OF, ont, null, taxon1, developsFrom); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, null, null); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertTrue("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, rootTaxon, partOf); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertTrue("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, taxon1, overlaps); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertTrue("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); edge2 = new OWLGraphEdge(source, target, partOf, Quantifier.SOME, ont, null, rootTaxon, overlaps); assertFalse("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge1, edge2)); assertTrue("GCI parameter inclusion error", wrapper.hasFirstEdgeMoreGeneralGCIParams(edge2, edge1)); }