Java 类org.semanticweb.owlapi.model.OWLAxiom 实例源码

项目:OWLAx    文件:AxiomsDialog.java   
public AxiomsDialog(IntegrateOntologyWithProtege integrateOntologyWithProtege, JFrame parent) {
    super(parent);
    this.parent = parent;
    this.selectedNewAxioms = new HashSet<OWLAxiom>();
    this.selectedExistingAxioms = new HashSet<OWLAxiom>();
    this.intgOntWProtege = integrateOntologyWithProtege;
    this.isClickedOK = false;

    new UserObjectforTreeView(parent, integrateOntologyWithProtege.getActiveOntology());

    // for sorting rendering is accomplished
    ManchesterOWLSyntaxPrefixNameShortFormProvider shortFormProvider = new ManchesterOWLSyntaxPrefixNameShortFormProvider(
            this.intgOntWProtege.getActiveOntology());
    rendering.setShortFormProvider(shortFormProvider);

    initUI();
    showUI();
}
项目:OWLAx    文件:AxiomsDialog.java   
private boolean isAlreadyListed(OWLAxiom axiom) {

        if (intgOntWProtege.getClassAssertionAxioms().contains(axiom))
            return true;
        if (intgOntWProtege.getSubClassOfAxioms().contains(axiom))
            return true;
        if (intgOntWProtege.getCardinalityAxioms().contains(axiom))
            return true;
        if (intgOntWProtege.getDomainAndRangeAxioms().contains(axiom))
            return true;
        if (intgOntWProtege.getDisJointOfAxioms().contains(axiom))
            return true;
        if (intgOntWProtege.getExistentialAxioms().contains(axiom))
            return true;

        return false;
    }
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
/**
 * First removing duplicates and then sorting
 * 
 * @param axiomArray
 * @return
 */
private ArrayList<OWLAxiom> removeDuplicateAndSort(ArrayList<OWLAxiom> axiomArray) {
    ArrayList<OWLAxiom> sortedAxiomArray = new ArrayList<>();
    Set<OWLAxiom> axiomSet = new HashSet<>();
    axiomSet.addAll(axiomArray);
    sortedAxiomArray.addAll(axiomSet);

    // before sorting it uses manchester encoding
    Collections.sort(sortedAxiomArray, new Comparator<OWLAxiom>() {

        @Override
        public int compare(OWLAxiom o1, OWLAxiom o2) {
            // TODO Auto-generated method stub

            String a1 = rendering.render(o1);
            String a2 = rendering.render(o2);

            return a1.compareToIgnoreCase(a2);
        }

    });

    return sortedAxiomArray;
}
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
private boolean showAxiomsDialog() {

        JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this.editor);
        AxiomsDialog dialog = new AxiomsDialog(this, topFrame);

        if (dialog.isClickedOK()) {
            selectedAxioms = dialog.getSelectedAxioms();
            if (!selectedAxioms.isEmpty()) {
                for (OWLAxiom axiom : selectedAxioms) {
                    changes.add(new AddAxiom(activeOntology, axiom));
                }
                return true;
            } else {
                editor.status("Selected Axioms is empty. Nothing to integrate.");
            }
        } else {
            editor.status("");
        }
        return false;
    }
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
private boolean commitDeclarations() {
    // editor.status("Integrating Declaration axioms with Protege ");
    if (declarationAxioms != null && !declarationAxioms.isEmpty()) {
        // declarationAxioms
        List<OWLOntologyChange> declarations = new ArrayList<OWLOntologyChange>();
        for (OWLAxiom declarationAxiom : declarationAxioms) {

            declarations.add(new AddAxiom(activeOntology, declarationAxiom));

        }
        ChangeApplied changeResult = owlOntologyManager.applyChanges(declarations);
        if (changeResult == ChangeApplied.SUCCESSFULLY) {
            editor.status("Declaration axioms integrated with protege successfully.");
            return true;
        } else if (changeResult == ChangeApplied.UNSUCCESSFULLY) {
            editor.status("Declaration integration with Protege unsuccessfull.");
            return false;
        } else if (changeResult == ChangeApplied.NO_OPERATION) {
            editor.status(
                    "Declaration axioms are duplicate. Possible reason: trying to create new OWL Entity which IRI match with existing OWLEntity IRI.");
            return false;
        }
    } else {

        editor.status("");
        return false;
    }

    return false;
}
项目:jcel    文件:TinyOntologyTest.java   
/**
 * @throws OWLOntologyCreationException
 *             if something goes wrong with the ontology creation
 */
@Test
public void testTinyOntology8() throws OWLOntologyCreationException {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();
    Set<OWLAxiom> axiomSet = new HashSet<>();
    OWLClass a = createNewClass(factory, "A");
    OWLClass b = createNewClass(factory, "B");
    OWLClass ab = createNewClass(factory, "AB");

    Set<OWLClass> aAndBSet = new HashSet<>();
    aAndBSet.add(a);
    aAndBSet.add(b);
    OWLClassExpression aAndB = factory.getOWLObjectIntersectionOf(aAndBSet);
    axiomSet.add(factory.getOWLEquivalentClassesAxiom(ab, aAndB));

    OWLOntology ontology = manager.createOntology(axiomSet);
    JcelReasonerFactory reasonerFactory = new JcelReasonerFactory();
    OWLReasoner reasoner = reasonerFactory.createReasoner(ontology);
    Set<OWLClass> expectedSet = new HashSet<>();
    expectedSet.add(ab);
    Node<OWLClass> expected = new OWLClassNode(expectedSet);
    Assert.assertEquals(expected, reasoner.getEquivalentClasses(ab));
    Assert.assertEquals(expected, reasoner.getEquivalentClasses(aAndB));
}
项目:Wolpertinger    文件:OWLNormalization.java   
public void processAxioms(Collection<? extends OWLAxiom> axioms) {
    AxiomVisitor axiomVisitor=new AxiomVisitor();

    for (OWLAxiom axiom : axioms) {
        axiom = preprocessAssertion(axiom);
        axiom.accept(axiomVisitor);
    }

    // now all axioms are in NNF and converted into disjunctions wherever possible
    // exact cardinalities are rewritten into at least and at most cardinalities etc
    // Rules with multiple head atoms are rewritten into several rules (Lloyd-Topor transformation)

    // normalize rules, this might add new concept and data range inclusions
    // in case a rule atom uses a complex concept or data range
    // we keep this inclusions separate because they are only applied to named individuals
    RuleNormalizer ruleNormalizer=new RuleNormalizer(m_axioms.m_rules,axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
    for (SWRLRule rule : axiomVisitor.m_rules)
        ruleNormalizer.visit(rule);

    // in normalization, we now simplify the disjuncts where possible (eliminate
    // unnecessary conjuncts/disjuncts) and introduce fresh atomic concepts for complex
    // concepts m_axioms.m_conceptInclusions contains the normalized axioms after the normalization
    normalizeInclusions(axiomVisitor.m_classExpressionInclusionsAsDisjunctions,axiomVisitor.m_dataRangeInclusionsAsDisjunctions);
}
项目:elk-reasoner    文件:OwlApiEntailmentQueryTest.java   
public OwlApiEntailmentQueryTest(
        final QueryTestManifest<OWLAxiom, Boolean> manifest) {
    super(manifest, new OwlApiReasoningTestDelegate<Boolean>(manifest) {

        @Override
        public Boolean getActualOutput() throws Exception {
            return getReasoner().isEntailed(manifest.getInput().getQuery());
        }

        @Override
        public Class<? extends Exception> getInterruptionExceptionClass() {
            return ReasonerInterruptedException.class;
        }

    });
}
项目:elk-reasoner    文件:InlinedClassInclusionExistentialPropertyExpansionStep.java   
private boolean process(ProofNode<OWLAxiom> node) {
    Collection<? extends ProofStep<OWLAxiom>> steps = node.getInferences();
    if (steps.size() > 1) {
        // don't expand multiple inferences
        return false;
    }
    for (ProofStep<OWLAxiom> step : steps) {
        // just one step
        if (canConvertStep(step) != null) {
            process(step);
            return true;
        }
    }
    // else
    return false;
}
项目:elk-reasoner    文件:EntailmentProofCompletenessTest.java   
public EntailmentProofCompletenessTest(
        final TestManifest<QueryTestInput<OWLAxiom>> manifest) {
    super(manifest, new OwlApiReasoningTestDelegate<Void>(manifest) {

        @Override
        public Void getActualOutput() throws Exception {
            // No output should be needed.
            throw new UnsupportedOperationException();
        }

        @Override
        public Class<? extends Exception> getInterruptionExceptionClass() {
            // No exception should be needed.
            throw new UnsupportedOperationException();
        }

    });
}
项目:Hermit_1.3.8_android    文件:Reasoner.java   
protected boolean isAsymmetric(
        OWLObjectPropertyExpression propertyExpression) {
    checkPreConditions(propertyExpression);
    if (!m_isConsistent)
        return true;
    OWLDataFactory factory = getDataFactory();
    OWLIndividual freshIndividualA = factory
            .getOWLAnonymousIndividual("fresh-individual-A");
    OWLIndividual freshIndividualB = factory
            .getOWLAnonymousIndividual("fresh-individual-B");
    OWLAxiom assertion1 = factory.getOWLObjectPropertyAssertionAxiom(
            propertyExpression, freshIndividualA, freshIndividualB);
    OWLAxiom assertion2 = factory.getOWLObjectPropertyAssertionAxiom(
            propertyExpression.getInverseProperty(), freshIndividualA,
            freshIndividualB);
    Tableau tableau = getTableau(assertion1, assertion2);
    boolean result = tableau.isSatisfiable(true, null, null, null, null,
            null, new ReasoningTaskDescription(true, "asymmetry of {0}",
                    H(propertyExpression)));
    tableau.clearAdditionalDLOntology();
    return !result;
}
项目:Source    文件:InitialOntologyConsistency.java   
private static void compareOntologies() throws OWLException, UnsupportedEncodingException,
        FileNotFoundException, IOException {
    // Write the diff between two ontologies to file
    OntoModel ontModelOriginal = new OntoModel(new File(
            "resources/airbus/input/ontology/component-03072015_original.rdf"), outputFolderName);
    Set<OWLAxiom> axiomsOriginal = ontModelOriginal.getOntologyAxioms();
    OntoModel ontModel = new OntoModel(new File(
            "resources/airbus/input/ontology/component-03072015_changed.rdf"), outputFolderName);
    Set<OWLAxiom> axioms = ontModel.getOntologyAxioms();
    axioms.removeAll(axiomsOriginal);
    // Write axioms that appeared in the second ontology to file
    String OntFileName = outputFolderName + "new_axioms.txt";
    String out = new String();
    java.util.Iterator<OWLAxiom> it = axioms.iterator();
    while (it.hasNext()) {
        out += it.next() + "\n";
    }
    // FileOperations.writeToFile(new File(OntFileName), out);
}
项目:owltools    文件:GAFOWLBridge.java   
protected void translateBioentity(Bioentity e) {
    OWLDataFactory fac = graph.getDataFactory();
    Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
    OWLClass cls = getOWLClass(e.getId());

    // --label---
    axioms.add(fac.getOWLAnnotationAssertionAxiom(fac.getRDFSLabel(),
            cls.getIRI(),
            fac.getOWLLiteral(e.getSymbol())));

    // --taxon--
    OWLClass taxCls = getOWLClass(e.getNcbiTaxonId()); // todo - cache
    axioms.add(fac.getOWLSubClassOfAxiom(cls, 
            fac.getOWLObjectSomeValuesFrom(getGeneAnnotationObjectProperty(Vocab.IN_TAXON), 
                    taxCls)));

    // TODO - other properties

    addAxioms(axioms);


}
项目:elk-reasoner    文件:InlinedClassInclusionHierarchyStep.java   
@Override
public Inference<OWLAxiom> getInference() {
    return new ElkOwlInference(FACTORY.getElkClassInclusionHierarchy(
            new AbstractList<ElkClassExpression>() {

                @Override
                public ElkClassExpression get(int index) {
                    switch (index) {
                    case 0:
                        return getElkSubClassOfAxiom(getPremises().get(0))
                                .getSubClassExpression();
                    default:
                        return getElkSubClassOfAxiom(
                                getPremises().get(index - 1))
                                        .getSuperClassExpression();
                    }
                }

                @Override
                public int size() {
                    return getPremises().size() + 1;
                }
            }));
}
项目:owltools    文件:MarkdownRenderer.java   
private void renderUsage(Set<OWLAxiom> refAxs) {
    List<String> axstrs = new ArrayList<String>();


    renderSection("Usage");
    int n = 0;
    for (OWLAxiom ax : refAxs) {
        axstrs.add(generateText(ax));
        n++;
        if (n > MAX_REFERENCING_AXIOMS) {
            renderTagValue("", "...TRUNCATED REMAINING AXIOMS");
        }
    }
    Collections.sort(axstrs);
    for (String axstr : axstrs) {
        renderTagValue("", axstr);
    }

}
项目:jcel    文件:ReverseAxiomTranslator.java   
@Override
public OWLAxiom visit(RI3Axiom axiom) {
    Objects.requireNonNull(axiom);
    OWLObjectProperty owlLeftSubProperty = translator.getTranslationRepository()
            .getOWLObjectProperty(axiom.getLeftSubProperty());
    OWLObjectProperty owlRightSubProperty = translator.getTranslationRepository()
            .getOWLObjectProperty(axiom.getRightSubProperty());
    OWLObjectProperty owlSuperProperty = translator.getTranslationRepository()
            .getOWLObjectProperty(axiom.getSuperProperty());
    Set<OWLAnnotation> owlAnnotations = translateAnnotations(axiom.getAnnotations());
    OWLDataFactory dataFactory = ontology.getOWLOntologyManager().getOWLDataFactory();
    List<OWLObjectProperty> owlPropertyList = new ArrayList<>();
    owlPropertyList.add(owlLeftSubProperty);
    owlPropertyList.add(owlRightSubProperty);
    return dataFactory.getOWLSubPropertyChainOfAxiom(owlPropertyList, owlSuperProperty, owlAnnotations);
}
项目:owltools    文件:AbstractSimEngineTest.java   
protected void runAll(OWLGraphWrapper  wrapper, OWLObject a, OWLObject b) throws Exception{
    OWLPrettyPrinter pp = new OWLPrettyPrinter(wrapper);
    SimEngine se = new SimEngine(wrapper);
    System.out.println("Comparing "+pp.render(a)+" -vs- "+pp.render(b));
    /*
    for (OWLObject x : wrapper.getDescendantsReflexive(a)) {
        System.out.println("d="+x);
    }
    */

    OWLClassExpression lcs = se.getLeastCommonSubsumerSimpleClassExpression(a, b);
    if (lcs != null) {
        System.out.println(" LCS: "+pp.render(lcs));            
    }

    Set<Similarity> r = se.calculateAllSimilarity(a, b);
    for (Similarity sim : r) {

        System.out.println(sim);
        for (OWLAxiom ax : sim.translateResultsToOWLAxioms()) {
            System.out.println("  Ax: "+pp.render(ax));
        }
    }

}
项目:owltools    文件:BasicABox.java   
protected void translateBioentity(Bioentity e) {
    OWLDataFactory fac = graph.getDataFactory();
    Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
    IRI iri = graph.getIRIByIdentifier(e.getId());
    OWLNamedIndividual cls =  graph.getDataFactory().getOWLNamedIndividual(iri);
    emap.put(e.getId(), cls);

    // --label---
    axioms.add(fac.getOWLAnnotationAssertionAxiom(fac.getRDFSLabel(),
            cls.getIRI(),
            fac.getOWLLiteral(e.getSymbol())));

    /*
    // --taxon--
    OWLClass taxCls = getOWLClass(e.getNcbiTaxonId()); // todo - cache
    axioms.add(fac.getOWLSubClassOfAxiom(cls, 
            fac.getOWLObjectSomeValuesFrom(getGeneAnnotationObjectProperty(Vocab.IN_TAXON), 
                    taxCls)));

    // TODO - other properties
     */

    addAxioms(axioms);


}
项目:OntoBench    文件:OwlThingFeature.java   
@Override
public void addToOntology() {
  OWLClass owlThing = factory.getOWLThing();
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(owlThing);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlClassFeature.java   
@Override
public void addToOntology() {
  OWLClass owlClass = featurePool.getReusableClass();
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(owlClass);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlObjectIntersectionOfFeature.java   
@Override
public void addToOntology() {
  OWLClass c1 = featurePool.getExclusiveClass(":ObjectIntersectionOf_Class1");
  OWLClass c2 = featurePool.getExclusiveClass(":ObjectIntersectionOf_Class2");
  OWLObjectIntersectionOf spork = factory.getOWLObjectIntersectionOf(c1, c2);

  OWLClass owlClass = featurePool.getExclusiveClass(":ObjectIntersectionOf");

  OWLAxiom axiom = factory.getOWLEquivalentClassesAxiom(owlClass, spork);
  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlNothingFeature.java   
@Override
public void addToOntology() {
  OWLClass owlNothing = factory.getOWLNothing();
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(owlNothing);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlDeprecatedClassFeature.java   
@Override
public void addToOntology() {
  OWLClass owlClass = featurePool.getExclusiveClass(":DeprecatedClass");
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(owlClass);
  addAxiomToOntology(axiom);

  OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
  OWLAxiom annotationAxiom = factory.getOWLAnnotationAssertionAxiom(owlClass.getIRI(), annotation);
  addAxiomToOntology(annotationAxiom);
}
项目:OntoBench    文件:OwlDeprecatedPropertyFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":DeprecatedProperty");
  addToGenericDomainAndNewRange(property, featurePool.getExclusiveClass(":DeprecatedPropertyRange"));

  OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
  OWLAxiom deprecatedAxiom = factory.getOWLAnnotationAssertionAxiom(property.getIRI(), annotation);
  addAxiomToOntology(deprecatedAxiom);
}
项目:OntoBench    文件:RdfsObjectSubPropertyOfFeature.java   
@Override
public void addToOntology() {
  OWLClass start = featurePool.getReusableClass();
  OWLClass middle = featurePool.getReusableClassDifferentFrom(start);
  OWLClass end = featurePool.getReusableClassDifferentFrom(start, middle);

  OWLObjectProperty subProperty = featurePool.getExclusiveProperty(":subObjectProperty");
  OWLObjectProperty superProperty = featurePool.getExclusiveProperty(":superObjectProperty");
  addProperty(start, subProperty, middle);
  addProperty(middle, superProperty, end);

  OWLAxiom axiom = factory.getOWLSubObjectPropertyOfAxiom(subProperty, superProperty);
  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:RdfsObjectRangeFeature.java   
@Override
public void addToOntology() {
  OWLClass range = featurePool.getExclusiveClass(":Range");
  OWLObjectProperty objectProperty = featurePool.getExclusiveProperty(":noDomainObjectProperty");
  OWLAxiom axiom = factory.getOWLObjectPropertyRangeAxiom(objectProperty, range);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:RdfsObjectDomainFeature.java   
@Override
public void addToOntology() {
  OWLClass domain = featurePool.getExclusiveClass(":Domain");
  OWLObjectProperty objectProperty = featurePool.getExclusiveProperty(":noRangeObjectProperty");
  OWLAxiom axiom = factory.getOWLObjectPropertyDomainAxiom(objectProperty, domain);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlInverseFunctionalPropertyFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":inverseFunctionalObjectProperty");
  OWLClass range = featurePool.getExclusiveClass(":InverseFunctionalObjectPropertyRange");
  addToGenericDomainAndNewRange(property, range);

  OWLAxiom axiom = factory.getOWLInverseFunctionalObjectPropertyAxiom(property);
  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlSymmetricPropertyFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":symmetricObjectProperty");
  OWLClass range = featurePool.getExclusiveClass(":SymmetricObjectPropertyRange");
  addToGenericDomainAndNewRange(property, range);

  OWLAxiom axiom = factory.getOWLSymmetricObjectPropertyAxiom(property);
  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:OwlTransitivePropertyFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":transitiveObjectProperty");
  OWLClass range = featurePool.getExclusiveClass(":TransitiveObjectPropertyRange");
  addToGenericDomainAndNewRange(property, range);

  OWLAxiom axiom = factory.getOWLTransitiveObjectPropertyAxiom(property);
  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:UnboundObjectPropertyFeature.java   
@Override
public void addToOntology() {
  OWLProperty property = featurePool.getExclusiveProperty(":noDomainAndRangeObjectProperty");
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(property);

  addAxiomToOntology(axiom);
}
项目:OntoBench    文件:RdfsSubClassOfFeature.java   
@Override
public void addToOntology() {
  OWLClass superClass = featurePool.getExclusiveClass(":SuperClass");
  OWLClass subClass = featurePool.getExclusiveClass(":SubClass");
  OWLAxiom subClassOfAxiom = factory.getOWLSubClassOfAxiom(subClass, superClass);

  addAxiomToOntology(subClassOfAxiom);
}
项目:OntoBench    文件:OwlEquivalentClassFeature.java   
@Override
public void addToOntology() {
  OWLClass owlClass = featurePool.getReusableClassAndRemoveFromPool();
  OWLClass equivalentClass1 = featurePool.getExclusiveClass(":EquivalentClass_1");
  OWLClass equivalentClass2 = featurePool.getExclusiveClass(":EquivalentClass_2");
  OWLAxiom equivalentAxiom = factory.getOWLEquivalentClassesAxiom(owlClass, equivalentClass1, equivalentClass2);

  addAxiomToOntology(equivalentAxiom);
}
项目:OBEP    文件:SemanticEvent.java   
public SemanticEvent(OWLNamedIndividual message, String packetID, long timeStamp, String stream) {
    this.axioms = new HashSet<OWLAxiom>();
    this.message = message;
    this.packetID = packetID;
    this.timeStamp = timeStamp;
    this.stream = stream;
}
项目:BENGAL    文件:StatisticalFunctionalityDetector.java   
private Double getConfidenceValue(OWLAxiom axiom) {
    Set<OWLAnnotation> annotations = axiom
            .getAnnotations(dataFactory.getOWLAnnotationProperty(confidencePropertyIRI));
    if (!annotations.isEmpty()) {
        OWLLiteral val = (OWLLiteral) annotations.iterator().next().getValue();
        return val.parseDouble();
    }
    return null;
}
项目:OWLAx    文件:AxiomsDialog.java   
public Set<OWLAxiom> getSelectedAxioms() {

        if (selectedExistingAxioms != null && !selectedExistingAxioms.isEmpty()) {
            selectedExistingAxioms.addAll(selectedNewAxioms);
            return selectedExistingAxioms;
        }
        return selectedNewAxioms;

    }
项目:OWLAx    文件:AxiomsDialog.java   
public AxiomsDialog() {
    super();

    this.selectedNewAxioms = new HashSet<OWLAxiom>();
    this.selectedExistingAxioms = new HashSet<OWLAxiom>();

    DefaultMutableTreeNode root = getRoot();

    final JCheckBoxTree cbt = new JCheckBoxTree(root, intgOntWProtege.getOwlEditorKit());

    DefaultMutableTreeNode inferredroot = (DefaultMutableTreeNode) cbt.getModel().getRoot();
    Enumeration e = inferredroot.breadthFirstEnumeration();

    initUI();

    cbt.addCheckChangeEventListener(new JCheckBoxTree.CheckChangeEventListener() {

        public void checkStateChanged(JCheckBoxTree.CheckChangeEvent event) {
            // System.out.println("event");
            TreePath[] paths = cbt.getCheckedPaths();
            for (TreePath tp : paths) {
                for (Object pathPart : tp.getPath()) {
                    DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) tp.getLastPathComponent();
                    if (parentNode.getUserObject() instanceof UserObjectforTreeView) {
                        // System.out.println("outside: can be done");
                        // System.out.println(((UserObjectforTreeView)
                        // parentNode.getUserObject()).isAxiom());
                    } 
                }
            }
        }
    });
    // this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
项目:OWLAx    文件:JCheckBoxTree.java   
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) {
    TreePath parentPath = tp.getParentPath();

    // If it is the root, stop the recursive calls and return
    if (parentPath == null) {
        return;
    }
    CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath);
    DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent();

    parentCheckedNode.allChildrenSelected = true;
    parentCheckedNode.isSelected = false;
    OWLAxiom axiom = null;

    for (int i = 0; i < parentNode.getChildCount(); i++) {

        TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i));
        CheckedNode childCheckedNode = nodesCheckingState.get(childPath);
        // It is enough that even one subtree is not fully selected
        // to determine that the parent is not fully selected
        if (!childCheckedNode.allChildrenSelected) {
            parentCheckedNode.allChildrenSelected = false;
        }
        // If at least one child is selected, selecting also the parent
        if (childCheckedNode.isSelected) {
            parentCheckedNode.isSelected = true;
        }
    }
    if (parentCheckedNode.isSelected) {
        checkedPaths.add(parentPath);
    } else {
        checkedPaths.remove(parentPath);
    }
    // Go to upper predecessor
    updatePredecessorsWithCheckMode(parentPath, check);
}
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
private void initializeDataStructure() {
    declarationAxioms = new ArrayList<OWLAxiom>();
    domainAndRangeAxioms = new ArrayList<OWLAxiom>();
    existentialAxioms = new ArrayList<OWLAxiom>();
    cardinalityAxioms = new ArrayList<OWLAxiom>();
    subClassOfAxioms = new ArrayList<OWLAxiom>();
    classAssertionAxioms = new ArrayList<OWLAxiom>();
    disJointOfAxioms = new ArrayList<OWLAxiom>();
    selectedAxioms = new HashSet<OWLAxiom>();

    changes = new ArrayList<OWLOntologyChange>();

}
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
public void cleanActiveOntology() {
    Set<OWLAxiom> axiomsToRemove;
    for (OWLOntology o : activeOntology.getImportsClosure()) {
        axiomsToRemove = new HashSet<OWLAxiom>();
        for (OWLAxiom ax : o.getAxioms()) {
            axiomsToRemove.add(ax);
        }

        owlOntologyManager.removeAxioms(o, axiomsToRemove);
        // System.out.println("After: " + o.getAxiomCount());
    }
}