protected TermTypeImpl(String name, TermTypeAncestry parentAncestry, boolean isAbstract) { this.name = name; this.isAbstract = isAbstract; this.ancestry = parentAncestry.newAncestry(this); }
/** * Can be overloaded */ @Override public TermType getCommonDenominator(TermType otherTermType){ if (equals(otherTermType)) return this; if (ancestry.contains(otherTermType)) return otherTermType; TermTypeAncestry otherAncestry = otherTermType.getAncestry(); if (otherAncestry.contains(this)) return this; return ancestry.getClosestCommonAncestor(otherAncestry); }
@Override public boolean isA(IRI baseDatatypeIri) { return getAncestry().getTermTypes() .filter(t -> t instanceof RDFDatatype) .map(t -> ((RDFDatatype)t).getIRI()) .anyMatch(baseDatatypeIri::equals); }