本文整理匯總了Java中org.semanticweb.owlapi.model.OWLAxiom類的典型用法代碼示例。如果您正苦於以下問題:Java OWLAxiom類的具體用法?Java OWLAxiom怎麽用?Java OWLAxiom使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OWLAxiom類屬於org.semanticweb.owlapi.model包,在下文中一共展示了OWLAxiom類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AxiomsDialog
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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();
}
示例2: isAlreadyListed
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
示例3: removeDuplicateAndSort
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
/**
* 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;
}
示例4: showAxiomsDialog
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
示例5: commitDeclarations
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
示例6: testTinyOntology8
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
/**
* @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));
}
示例7: processAxioms
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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);
}
示例8: OwlApiEntailmentQueryTest
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
});
}
示例9: process
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
開發者ID:liveontologies,項目名稱:elk-reasoner,代碼行數:17,代碼來源:InlinedClassInclusionExistentialPropertyExpansionStep.java
示例10: EntailmentProofCompletenessTest
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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();
}
});
}
示例11: isAsymmetric
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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;
}
示例12: compareOntologies
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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);
}
示例13: translateBioentity
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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);
}
示例14: getInference
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
@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;
}
}));
}
示例15: renderUsage
import org.semanticweb.owlapi.model.OWLAxiom; //導入依賴的package包/類
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);
}
}