/** * @param rule the rule * @return written axioms */ public Collection<OWLAxiom> write(SWRLRule rule) { List<OWLAxiom> axioms = new ArrayList<>(1); if (o.containsAxiom(rule)) { writeSection(RULE, CollectionFactory.createSet(rule).iterator(), "", true); axioms.add(rule); } return axioms; }
/** * @param rule the rule * @return written axioms */ public Collection<OWLAxiom> write(SWRLRule rule) { List<OWLAxiom> axioms = new ArrayList<>(1); if (o.containsAxiom(rule)) { writeSection(RULE, CollectionFactory.createSet(rule).iterator(), "", true); axioms.add(rule); } return axioms; }
/** * @param rule the rule * @return written axioms */ public Collection<OWLAxiom> write(SWRLRule rule) { List<OWLAxiom> axioms = new ArrayList<>(1); if (o.containsAxiom(rule)) { writeSection(RULE, CollectionFactory.createSet(rule).iterator(), "", true); axioms.add(rule); } return axioms; }
/** * @param rule the rule * @return written axioms */ public Collection<OWLAxiom> write(SWRLRule rule) { List<OWLAxiom> axioms = new ArrayList<>(1); if (o.containsAxiom(rule)) { writeSection(RULE, CollectionFactory.createSet(rule).iterator(), "", true); axioms.add(rule); } return axioms; }
protected <T> void writeMoreThanTwo(OWLAxiom ax, Stream<T> stream, ManchesterOWLSyntax section) { List<T> individuals = asList(stream); if (individuals.size() > 2) { SectionMap<Object, OWLAxiom> map = new SectionMap<>(); map.put(individuals, ax); writeSection(section, map, ",", false); } }
protected <T> void writeMoreThanTwo(OWLAxiom ax, Stream<T> stream, ManchesterOWLSyntax section) { List<T> individuals = asList(stream); if (individuals.size() > 2) { SectionMap<Object, OWLAxiom> map = new SectionMap<>(); map.put(individuals, ax); writeSection(section, map, ",", false); } }
protected <T> void writeMoreThanTwo(OWLAxiom ax, Stream<T> stream, ManchesterOWLSyntax section) { List<T> individuals = asList(stream); if (individuals.size() > 2) { SectionMap<Object, OWLAxiom> map = new SectionMap<>(); map.put(individuals, ax); writeSection(section, map, ",", false); } }
protected <T> void writeMoreThanTwo(OWLAxiom ax, Stream<T> stream, ManchesterOWLSyntax section) { List<T> individuals = asList(stream); if (individuals.size() > 2) { SectionMap<Object, OWLAxiom> map = new SectionMap<>(); map.put(individuals, ax); writeSection(section, map, ",", false); } }
/** * @param datatype the datatype * @return the sets the */ public Collection<OWLAxiom> write(OWLDatatype datatype) { List<OWLAxiom> axioms = new ArrayList<>(); axioms.addAll(writeEntityStart(DATATYPE, datatype)); if (!isFiltered(AxiomType.DATATYPE_DEFINITION)) { Collection<OWLDataRange> dataRanges = sortedCollection(); o.datatypeDefinitions(datatype).filter(this::isDisplayed).forEach(ax -> { axioms.add(ax); dataRanges.add(ax.getDataRange()); }); writeSection(EQUIVALENT_TO, dataRanges.iterator(), ",", true); } writeEntitySectionEnd(DATATYPE.toString()); return axioms; }
/** * @param datatype the datatype * @return the sets the */ public Collection<OWLAxiom> write(OWLDatatype datatype) { List<OWLAxiom> axioms = new ArrayList<>(); axioms.addAll(writeEntityStart(DATATYPE, datatype)); if (!isFiltered(AxiomType.DATATYPE_DEFINITION)) { Collection<OWLDataRange> dataRanges = sortedCollection(); o.datatypeDefinitions(datatype).filter(this::isDisplayed).forEach(ax -> { axioms.add(ax); dataRanges.add(ax.getDataRange()); }); writeSection(EQUIVALENT_TO, dataRanges.iterator(), ",", true); } writeEntitySectionEnd(DATATYPE.toString()); return axioms; }
/** * @param datatype the datatype * @return the sets the */ public Collection<OWLAxiom> write(OWLDatatype datatype) { List<OWLAxiom> axioms = new ArrayList<>(); axioms.addAll(writeEntityStart(DATATYPE, datatype)); if (!isFiltered(AxiomType.DATATYPE_DEFINITION)) { Collection<OWLDataRange> dataRanges = sortedCollection(); o.datatypeDefinitions(datatype).filter(this::isDisplayed).forEach(ax -> { axioms.add(ax); dataRanges.add(ax.getDataRange()); }); writeSection(EQUIVALENT_TO, dataRanges.iterator(), ",", true); } writeEntitySectionEnd(DATATYPE.toString()); return axioms; }
/** * @param datatype the datatype * @return the sets the */ public Collection<OWLAxiom> write(OWLDatatype datatype) { List<OWLAxiom> axioms = new ArrayList<>(); axioms.addAll(writeEntityStart(DATATYPE, datatype)); if (!isFiltered(AxiomType.DATATYPE_DEFINITION)) { Collection<OWLDataRange> dataRanges = sortedCollection(); o.datatypeDefinitions(datatype).filter(this::isDisplayed).forEach(ax -> { axioms.add(ax); dataRanges.add(ax.getDataRange()); }); writeSection(EQUIVALENT_TO, dataRanges.iterator(), ",", true); } writeEntitySectionEnd(DATATYPE.toString()); return axioms; }
/** * Write annotations. * * @param subject the subject * @return written axioms */ public Collection<OWLAnnotationAssertionAxiom> writeAnnotations(OWLAnnotationSubject subject) { Collection<OWLAnnotationAssertionAxiom> axioms = sortedCollection(); if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) { SectionMap<Object, OWLAxiom> sectionMap = new SectionMap<>(); filtersort(o.annotationAssertionAxioms(subject)).forEach(ax -> { axioms.add(ax); sectionMap.put(ax.getAnnotation(), ax); }); writeSection(ANNOTATIONS, sectionMap, ",", true); } return axioms; }
/** * Write annotations. * * @param subject the subject * @return written axioms */ public Collection<OWLAnnotationAssertionAxiom> writeAnnotations(OWLAnnotationSubject subject) { Collection<OWLAnnotationAssertionAxiom> axioms = sortedCollection(); if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) { SectionMap<Object, OWLAxiom> sectionMap = new SectionMap<>(); filtersort(o.annotationAssertionAxioms(subject)).forEach(ax -> { axioms.add(ax); sectionMap.put(ax.getAnnotation(), ax); }); writeSection(ANNOTATIONS, sectionMap, ",", true); } return axioms; }
/** * Write annotations. * * @param subject the subject * @return written axioms */ public Collection<OWLAnnotationAssertionAxiom> writeAnnotations(OWLAnnotationSubject subject) { Collection<OWLAnnotationAssertionAxiom> axioms = sortedCollection(); if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) { SectionMap<Object, OWLAxiom> sectionMap = new SectionMap<>(); filtersort(o.annotationAssertionAxioms(subject)).forEach(ax -> { axioms.add(ax); sectionMap.put(ax.getAnnotation(), ax); }); writeSection(ANNOTATIONS, sectionMap, ",", true); } return axioms; }
/** * Write annotations. * * @param subject the subject * @return written axioms */ public Collection<OWLAnnotationAssertionAxiom> writeAnnotations(OWLAnnotationSubject subject) { Collection<OWLAnnotationAssertionAxiom> axioms = sortedCollection(); if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) { SectionMap<Object, OWLAxiom> sectionMap = new SectionMap<>(); filtersort(o.annotationAssertionAxioms(subject)).forEach(ax -> { axioms.add(ax); sectionMap.put(ax.getAnnotation(), ax); }); writeSection(ANNOTATIONS, sectionMap, ",", true); } return axioms; }
/** * Write entity start. * * @param keyword the keyword * @param entity the entity * @return written axioms */ private Collection<OWLAnnotationAssertionAxiom> writeEntityStart(ManchesterOWLSyntax keyword, OWLObject entity) { event = new RendererEvent(this, entity); String kw = keyword.toString(); fireFrameRenderingPrepared(kw); writeSection(keyword); entity.accept(this); fireFrameRenderingStarted(kw); writeNewLine(); incrementTab(4); writeNewLine(); if (entity instanceof OWLEntity) { return writeAnnotations(((OWLEntity) entity).getIRI()); } else if (entity instanceof OWLAnonymousIndividual) { return writeAnnotations((OWLAnonymousIndividual) entity); } return Collections.emptySet(); }
/** * Write ontology header. */ public void writeOntologyHeader() { event = new RendererEvent(this, o); fireFrameRenderingPrepared(ONTOLOGY.toString()); write(ONTOLOGY.toString()); write(":"); writeSpace(); if (!o.isAnonymous()) { int indent = getIndent(); writeFullURI(o.getOntologyID().getOntologyIRI().get().toString()); writeNewLine(); pushTab(indent); Optional<IRI> versionIRI = o.getOntologyID().getVersionIRI(); if (versionIRI.isPresent()) { writeFullURI(versionIRI.get().toString()); } popTab(); } fireFrameRenderingStarted(ONTOLOGY.toString()); writeNewLine(); o.importsDeclarations().sorted().forEach(this::writeImports); writeNewLine(); writeSection(ANNOTATIONS, o.annotations().iterator(), ",", true); fireFrameRenderingFinished(ONTOLOGY.toString()); }
/** * Write entity start. * * @param keyword the keyword * @param entity the entity * @return written axioms */ private Collection<OWLAnnotationAssertionAxiom> writeEntityStart(ManchesterOWLSyntax keyword, OWLObject entity) { event = new RendererEvent(this, entity); String kw = keyword.toString(); fireFrameRenderingPrepared(kw); writeSection(keyword); entity.accept(this); fireFrameRenderingStarted(kw); writeNewLine(); incrementTab(4); writeNewLine(); if (entity instanceof OWLEntity) { return writeAnnotations(((OWLEntity) entity).getIRI()); } else if (entity instanceof OWLAnonymousIndividual) { return writeAnnotations((OWLAnonymousIndividual) entity); } return Collections.emptySet(); }
/** * Write entity start. * * @param keyword the keyword * @param entity the entity * @return written axioms */ private Collection<OWLAnnotationAssertionAxiom> writeEntityStart(ManchesterOWLSyntax keyword, OWLObject entity) { event = new RendererEvent(this, entity); String kw = keyword.toString(); fireFrameRenderingPrepared(kw); writeSection(keyword); entity.accept(this); fireFrameRenderingStarted(kw); writeNewLine(); incrementTab(4); writeNewLine(); if (entity instanceof OWLEntity) { return writeAnnotations(((OWLEntity) entity).getIRI()); } else if (entity instanceof OWLAnonymousIndividual) { return writeAnnotations((OWLAnonymousIndividual) entity); } return Collections.emptySet(); }