public void retrieveRoomsMap() { // this method retrieves the rooms to be insserted in the two rooms lists. // it deposits the retrieved data in a map where the key is the room name (String) and the value // is the corresponding entity IRI. // the above data structure will be used in passing the entity IRIs in the jess working memory // when constructing the facts // when the respective room name (String) is selected in the rooms list combo box. for (OWLSubClassOfAxiom scoAx : topIxOnt.getSubClassAxiomsForSuperClass( OWLFactory.getOWLClass( IRI.create( "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#Room")))) { String tmpS = scoAx.getSubClass().toString(); Set<OWLAnnotationAssertionAxiom> tmpAnnSet = topIxOnt.getAnnotationAssertionAxioms( IRI.create(tmpS.substring(tmpS.indexOf('<') + 1, tmpS.indexOf('>')))); for (OWLAnnotationAssertionAxiom aaAx : tmpAnnSet) { if (aaAx.getProperty() .toString() .equals( "<http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#classID>")) { roomToIRI.put( aaAx.getValue().toString().substring(1, aaAx.getValue().toString().indexOf('^') - 1), tmpS.substring(tmpS.indexOf('<') + 1, tmpS.indexOf('>'))); } } } }
public Set<OWLAxiom> write(OWLClass cls) { Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); axioms.addAll(writeEntityStart(CLASS, cls)); if (!isFiltered(AxiomType.EQUIVALENT_CLASSES)) { for (OWLOntology ontology : getOntologies()) { SectionMap equivalentClasses = new SectionMap(); for (OWLEquivalentClassesAxiom ax : ontology.getEquivalentClassesAxioms(cls)) { if (ax.getClassExpressions().size() == 2) { if (isDisplayed(ax)) { for (OWLClassExpression equivCls : ax.getClassExpressionsMinus(cls)) { equivalentClasses.add(equivCls, ax); } axioms.add(ax); } } } equivalentClasses.remove(cls); writeSection(EQUIVALENT_TO, equivalentClasses, ",", true, ontology); } } if (!isFiltered(AxiomType.SUBCLASS_OF)) { for (OWLOntology ontology : getOntologies()) { SectionMap superclasses = new SectionMap(); for (OWLSubClassOfAxiom ax : ontology.getSubClassAxiomsForSubClass(cls)) { if (isDisplayed(ax)) { superclasses.add(ax.getSuperClass(), ax); axioms.add(ax); } } writeSection(SUBCLASS_OF, superclasses, ",", true, ontology); } if (renderExtensions) { for (OWLOntology ont : getOntologies()) { SectionMap subClasses = new SectionMap(); for (OWLSubClassOfAxiom ax : ont.getSubClassAxiomsForSuperClass(cls)) { if (isDisplayed(ax)) { subClasses.add(ax.getSubClass(), ax); axioms.add(ax); } } writeSection(SUPERCLASS_OF, subClasses, ",", true, ont); } } } if (!isFiltered(AxiomType.DISJOINT_CLASSES)) { for (OWLOntology ontology : getOntologies()) { Set<OWLAxiom> pairwiseDisjointClassesAxioms = new HashSet<OWLAxiom>(); SectionMap disjointClasses = new SectionMap(); for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) { if (isDisplayed(ax)) { if (ax.getClassExpressions().size() == 2) { pairwiseDisjointClassesAxioms.add(ax); OWLClassExpression disjointWith = ax.getClassExpressionsMinus(cls).iterator().next(); disjointClasses.add(disjointWith, ax); } axioms.add(ax); } } writeSection(DISJOINT_WITH, disjointClasses, ", ", false, ontology); if (renderExtensions) { // Handling of nary in frame style for (OWLDisjointClassesAxiom ax : ontology.getDisjointClassesAxioms(cls)) { if (isDisplayed(ax)) { if (ax.getClassExpressions().size() > 2) { Set<OWLClassExpression> allDisjointClasses = new TreeSet<OWLClassExpression>(ax.getClassExpressions()); allDisjointClasses.remove(cls); axioms.add(ax); writeSection(DISJOINT_CLASSES, allDisjointClasses, ", ", false, ontology); } } } } } } if (!isFiltered(AxiomType.HAS_KEY)) { for (OWLOntology ontology : getOntologies()) { for (OWLHasKeyAxiom ax : ontology.getHasKeyAxioms(cls)) { if (isDisplayed(ax)) { SectionMap map = new SectionMap(); map.add(ax.getPropertyExpressions(), ax); writeSection(HAS_KEY, map, ", ", true, ontology); } } } } if (!isFiltered(AxiomType.CLASS_ASSERTION)) { for (OWLOntology ontology : getOntologies()) { SectionMap individuals = new SectionMap(); for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(cls)) { if (isDisplayed(ax)) { if (renderExtensions || ax.getIndividual().isAnonymous()) { individuals.add(ax.getIndividual(), ax); axioms.add(ax); } } } writeSection(INDIVIDUALS, individuals, ",", true, ontology); } } if (!isFiltered(AxiomType.SWRL_RULE)) { for (OWLOntology ontology : getOntologies()) { Set<OWLAxiom> rules = new HashSet<OWLAxiom>(); for (SWRLRule rule : ontology.getAxioms(AxiomType.SWRL_RULE)) { if (isDisplayed(rule)) { for (SWRLAtom atom : rule.getHead()) { if (atom.getPredicate().equals(cls)) { writeSection(RULE, rules, ", ", true, ontology); break; } } } } } } writeEntitySectionEnd(CLASS.toString()); return axioms; }