/** * @param ontology ontology * @param axiom axiom */ public UseOfIllegalAxiom(OWLOntology ontology, OWLAxiom axiom) { super(ontology, axiom, axiom.getAxiomType()); }
/** * Checks whether the given OWLAxiom is a TBox axiom * * @param axiom the axiom to be checked * @return true if the axiom is a TBox axiom */ public static boolean isTBoxAxiom(OWLAxiom axiom) { return (TBOX_AXIOM_TYPES.contains(axiom.getAxiomType())); }
public static boolean isAboxAxiom(OWLAxiom ax) { return ax.getAxiomType().equals(AxiomType.DATA_PROPERTY_ASSERTION) || ax.getAxiomType().equals(AxiomType.OBJECT_PROPERTY_ASSERTION) || ax.getAxiomType().equals(AxiomType.CLASS_ASSERTION) || ax.getAxiomType().equals(AxiomType.SAME_INDIVIDUAL) || ax.getAxiomType().equals(AxiomType.DIFFERENT_INDIVIDUALS); } public static void saveRDFXML(OWLOntology ont, File out) throws IOException {
/** * Determines if this axiom is one of the specified types * * @param types The axiom types to check for * @return {@code true} if this axioms is one of the specified types, otherwise {@code false} * @since 3.0 */ default boolean isOfType(Collection<AxiomType<?>> types) { return types.contains(getAxiomType()); }
/** * Determines if this axiom is one of the specified types * * @param types The axiom types to check for * @return {@code true} if this axioms is one of the specified types, otherwise {@code false} * @since 3.0 */ default boolean isOfType(Stream<AxiomType<?>> types) { return types.anyMatch(getAxiomType()::equals); }
/** * Determines if this axiom is one of the specified types * * @param types The axiom types to check for * @return {@code true} if this axioms is one of the specified types, otherwise {@code false} * @since 3.0 */ default boolean isOfType(Collection<AxiomType<?>> types) { return types.contains(getAxiomType()); }
public boolean containsAxiom(OWLAxiom axiom) { Set<OWLAxiom> axioms = axiomsByType.get(axiom.getAxiomType()); return axioms != null && axioms.contains(axiom); }
@Override public boolean pass(@Nonnull OWLAxiom axiom, Object key) { // for this filter, only accept the axioms whose types are not in // tbox or rbox return !AxiomType.TBoxAndRBoxAxiomTypes.contains(axiom.getAxiomType()); } };
/** * Gets the set of axioms from a source set of axioms that have a specified type. * * @param sourceAxioms The source set of axioms * @param axiomTypes The types of axioms that will be returned * @return A set of axioms that represents the sourceAxioms that have the specified types. Note * that sourceAxioms will not be modified. The returned set is a copy. */ public static Set<OWLAxiom> getAxiomsOfTypes(Collection<OWLAxiom> sourceAxioms, AxiomType<?>... axiomTypes) { Set<AxiomType<?>> allowed = Sets.newHashSet(axiomTypes); return asSet(sourceAxioms.stream().filter(a -> allowed.contains(a.getAxiomType()))); }
private void handleOntologyChanges(List<? extends OWLOntologyChange> changes) { changes.stream() .filter(OWLOntologyChange::isAxiomChange) .map(OWLOntologyChange::getAxiom) .filter(ax -> ax.getAxiomType() == DISJOINT_CLASSES) .findAny().ifPresent(ax -> updateState()); }
@Override default int typeIndex() { return 2000 + getAxiomType().getIndex(); }
@Override public int compare(OWLAxiom o1, OWLAxiom o2) { AxiomType<?> type1 = o1.getAxiomType(); AxiomType<?> type2 = o2.getAxiomType(); return getTypeIndex(type1) - getTypeIndex(type2); }
@Override public Stream<OWLAxiom> axiomsIgnoreAnnotations(OWLAxiom axiom) { return axioms(axiom.getAxiomType()).map(x -> (OWLAxiom) x) .filter(ax -> ax.equalsIgnoreAnnotations(axiom)); }
private boolean shouldWrite(OWLAxiom ax) { if (ax.getAxiomType().equals(AxiomType.DIFFERENT_INDIVIDUALS)) { return false; } if (ax.getAxiomType().equals(AxiomType.DISJOINT_CLASSES) && ((OWLDisjointClassesAxiom) ax).classExpressions().count() > 2) { return false; } return true; }
/** * @param type axiom type to check * @return true if this is an axiom change and the axiom type is the specified type */ public boolean isAxiomChange(AxiomType<?> type) { return getAddedOrRemovedAxiom().filter(ax -> ax.getAxiomType().equals(type)).isPresent(); }
@Override public int compare(@Nullable OWLAxiom o1, @Nullable OWLAxiom o2) { int index1 = verifyNotNull(o1).getAxiomType().getIndex(); int index2 = verifyNotNull(o2).getAxiomType().getIndex(); return index1 - index2; } }
/** * @param type axiom type to check * @return true if this is an axiom change and the axiom type is the specified type */ public boolean isAxiomChange(AxiomType<?> type) { return getAddedOrRemovedAxiom().filter(ax -> ax.getAxiomType().equals(type)).isPresent(); }
@Nonnull @Override public Void visit(AddAxiomData data) throws RuntimeException { if (data.getAxiom().getAxiomType().equals(axiomType)) { addAxiom = Optional.of((A) data.getAxiom()); } return null; }
@Override public boolean containsAxiomIgnoreAnnotations(OWLAxiom axiom) { if (containsAxiom(axiom)) { return true; } return axioms(axiom.getAxiomType()).anyMatch(ax -> ax.equalsIgnoreAnnotations(axiom)); }
@Override public void generateSearchMetadataFor(final OWLAxiom axiom, OWLEntity axiomSubject, String axiomSubjectRendering, final SearchMetadataImportContext context, SearchMetadataDB db) { StyledString rendering = context.getStyledStringRendering(axiom); String groupDescription = axiom.getAxiomType().getName(); SearchMetadata md = new SearchMetadata(SearchCategory.LOGICAL_AXIOM, groupDescription, axiomSubject, axiomSubjectRendering, rendering.getString()) { @Override public StyledString getStyledSearchSearchString() { return context.getStyledStringRendering(axiom); } }; db.addResult(md); } }