本文整理汇总了Java中org.semanticweb.owlapi.model.AddAxiom类的典型用法代码示例。如果您正苦于以下问题:Java AddAxiom类的具体用法?Java AddAxiom怎么用?Java AddAxiom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AddAxiom类属于org.semanticweb.owlapi.model包,在下文中一共展示了AddAxiom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showAxiomsDialog
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的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;
}
示例2: commitDeclarations
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的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;
}
示例3: addNegatedAttributeToObject
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Asserts that the given individual is an instance of the complement of the given type.
* @param type the given type
* @param indObj the given individual about which the assertion will be made
* @return <code>true</code> if the assertion is successful
*/
@Override
public boolean addNegatedAttributeToObject(OWLClass type,IndividualObject indObj) {
OWLClassAssertionAxiom axiom = getFactory().getOWLClassAssertionAxiom(
ELIndividualObject.getComplement(getOntology(), type),
indObj.getIdentifier());
AddAxiom addAxiom = new AddAxiom(getOntology(),axiom);
try {
getManager().applyChange(addAxiom);
reClassifyOntology();
updateObjects(Constants.AFTER_MODIFICATION);
updateObjectDescriptions(Constants.AFTER_MODIFICATION);
}
catch (OWLOntologyChangeException e) {
e.printStackTrace();
System.exit(-1);
}
getHistory().push(new ClassAssertionChange(this,addAxiom,indObj.getIdentifier(),type,true));
return true;
}
示例4: addIndividualToOntology
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Adds a given individual to the ontology as an instance of <code>Thing</code>
* @param object the given object to be added
* @return <code>true</code> if the object is successfully added
*/
// @Override
public boolean addIndividualToOntology(OWLNamedIndividual object) {
OWLClassAssertionAxiom axiom = getFactory().getOWLClassAssertionAxiom(getFactory().getOWLThing(), object);
AddAxiom addAxiom = new AddAxiom(getOntology(),axiom);
Set<OWLClass> attrs = new HashSet<OWLClass>();
try {
getManager().applyChange(addAxiom);
reClassifyOntology();
IndividualObject indObj = createIndividualObject(object);
indObj.updateDescription(Constants.AFTER_MODIFICATION);
addObject(indObj);
}
catch (OWLOntologyChangeException e) {
e.printStackTrace();
System.exit(-1);
}
attrs.add(getFactory().getOWLThing());
getHistory().push(new NewIndividualChange(this,addAxiom,object,attrs));
return true;
}
示例5: addAttributeToObject
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Asserts that the given individual is an instance of the given type.
* @param type the given type
* @param indObj the given individual about which the assertion will be made
* @return <code>true</code> if the assertion is successful
*/
public boolean addAttributeToObject(OWLClass type,IndividualObject indObj) {
OWLClassAssertionAxiom axiom = getFactory().getOWLClassAssertionAxiom(type, indObj.getIdentifier());
AddAxiom addAxiom = new AddAxiom(getOntology(),axiom);
try {
getManager().applyChange(addAxiom);
reClassifyOntology();
updateObjects(Constants.AFTER_MODIFICATION);
updateObjectDescriptions(Constants.AFTER_MODIFICATION);
}
catch (OWLOntologyChangeException e) {
e.printStackTrace();
System.exit(-1);
}
getHistory().push(new ClassAssertionChange(this,addAxiom,indObj.getIdentifier(),type,false));
return true;
}
示例6: addNegatedAttributeToObject
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Asserts that the given individual is an instance of the complement of the given type.
* @param type the given type
* @param indObj the given individual about which the assertion will be made
* @return <code>true</code> if the assertion is successful
*/
public boolean addNegatedAttributeToObject(OWLClass type,IndividualObject indObj) {
OWLClassAssertionAxiom axiom = getFactory().getOWLClassAssertionAxiom(getFactory().getOWLObjectComplementOf(type), indObj.getIdentifier());
AddAxiom addAxiom = new AddAxiom(getOntology(),axiom);
try {
getManager().applyChange(addAxiom);
reClassifyOntology();
updateObjects(Constants.AFTER_MODIFICATION);
updateObjectDescriptions(Constants.AFTER_MODIFICATION);
}
catch (OWLOntologyChangeException e) {
e.printStackTrace();
System.exit(-1);
}
getHistory().push(new ClassAssertionChange(this,addAxiom,indObj.getIdentifier(),type,true));
return true;
}
示例7: addPTBoxConstraints
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
protected void addPTBoxConstraints(OWLOntology ontology, PTBox ptbox,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(ptbox.getClassicalKnowledgeBase(), factory);
for (ConditionalConstraint cc : ptbox.getDefaultConstraints()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create(Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLClassExpression clsEv = (OWLClassExpression)converter.convert( cc.getEvidence() );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLSubClassOfAxiom( clsEv, clsCn, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
示例8: addDummyAxiom2Ontology
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
public void addDummyAxiom2Ontology(){
OWLClass dummycls = dataFactory.getOWLClass(IRI.create("http://logmap.cs.ox.ac.uk/ontologies#TopClass"));
managerOnto.applyChange(
new AddAxiom(
onto,
dataFactory.getOWLDeclarationAxiom(dummycls)));
managerOnto.applyChange(
new AddAxiom(
onto,
dataFactory.getOWLSubClassOfAxiom(
dummycls,
dataFactory.getOWLThing())));
}
示例9: addClassMapping2Output
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Creates OWL axioms for mapping and adds it to the list
*/
public void addClassMapping2Output(String iri1, String iri2, int dir_mapping, double conf) {
if (dir_mapping==LogMap_Lite.EQ){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createEquivalenceMapping(
factory.getOWLClass(IRI.create(iri1)),
factory.getOWLClass(IRI.create(iri2)))));
}
else if (dir_mapping==LogMap_Lite.L2R){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSubClassOfMapping(
factory.getOWLClass(IRI.create(iri1)),
factory.getOWLClass(IRI.create(iri2)))));
}
else{ //if (dir_mapping==LogMap_Lite.R2L){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSuperClassOfMapping(
factory.getOWLClass(IRI.create(iri1)),
factory.getOWLClass(IRI.create(iri2)))));
}
}
示例10: addDataPropMapping2Output
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Creates OWL axioms for mapping and adds it to the list
*/
public void addDataPropMapping2Output(String iri1, String iri2, int dir_mapping, double conf) {
if (dir_mapping==LogMap_Lite.EQ){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createDataPropertyEquivalenceMapping(
factory.getOWLDataProperty(IRI.create(iri1)),
factory.getOWLDataProperty(IRI.create(iri2)))));
}
else if (dir_mapping==LogMap_Lite.L2R){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSubDataPropertyMapping(
factory.getOWLDataProperty(IRI.create(iri1)),
factory.getOWLDataProperty(IRI.create(iri2)))));
}
else{ //if (dir_mapping==LogMap_Lite.R2L){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSuperDataPropertyMapping(
factory.getOWLDataProperty(IRI.create(iri1)),
factory.getOWLDataProperty(IRI.create(iri2)))));
}
}
示例11: addObjPropMapping2Output
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Creates OWL axioms for mapping and adds it to the list
*/
public void addObjPropMapping2Output(String iri1, String iri2, int dir_mapping, double conf) {
if (dir_mapping==LogMap_Lite.EQ){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createObjectPropertyEquivalenceMapping(
factory.getOWLObjectProperty(IRI.create(iri1)),
factory.getOWLObjectProperty(IRI.create(iri2)))));
}
else if (dir_mapping==LogMap_Lite.L2R){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSubObjectPropertyMapping(
factory.getOWLObjectProperty(IRI.create(iri1)),
factory.getOWLObjectProperty(IRI.create(iri2)))));
}
else{ //if (dir_mapping==LogMap_Lite.R2L){
listAxioms2Add.add(new AddAxiom(
mappingsOnto,
createSuperObjectPropertyMapping(
factory.getOWLObjectProperty(IRI.create(iri1)),
factory.getOWLObjectProperty(IRI.create(iri2)))));
}
}
示例12: getModuleFromAxioms
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* Necessary toi construct a module for an arbitriary set of axioms
* @param moduleAxioms
* @param moduleUri
* @return
*/
public OWLOntology getModuleFromAxioms(Set<OWLAxiom> moduleAxioms, IRI moduleIri) {
OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
OWLOntology module=null;
try {
module = ontologyManager.createOntology(moduleIri);
List<OWLOntologyChange> ontoChanges = new ArrayList<OWLOntologyChange>();
for(OWLAxiom axiom : moduleAxioms) {
ontoChanges.add(new AddAxiom(module, axiom));
}
ontologyManager.applyChanges(ontoChanges);
}
catch(Exception e) {
System.out.println("Error creating module ontology from extende set of axioms.");
}
//System.out.println("Time create OWLOntology for module (s): " + (double)((double)fin-(double)init)/1000.0);
return module;
}
示例13: parse
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
public void parse(File myFile) throws IOException {
try (BufferedReader reader = new BufferedReader(new FileReader(myFile))) {
for(String line : IOUtils.readLines(reader)) {
String[] row = line.split("\t");
if (config.defaultCol1 != null)
row[0] = config.defaultCol1;
if (config.defaultCol2 != null) {
String[] row2 = new String[2];
row2[0] = row[0];
row = row2;
row[1] = config.defaultCol2;
}
addRow(row);
}
}
if (config.individualsType != null) {
OWLDataFactory df = graph.getDataFactory();
graph.getManager().applyChange(new AddAxiom(graph.getSourceOntology(),
df.getOWLDeclarationAxiom(config.individualsType)));
}
}
示例14: addAnnotation
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/** Adding the set annotations to the entity from the given ontology using the given manager.
* @param modelManager
* @param currentEntity
* @param ontology
* @param annotations
*/
public static void addAnnotation(OWLModelManager modelManager,
OWLEntity currentEntity,
OWLOntology ontology,
Set<OWLAnnotation> annotations) {
OWLDataFactory factory = modelManager.getOWLDataFactory();
List<OWLOntologyChange> changes = new Vector<OWLOntologyChange>();
for(OWLAnnotation annot : annotations) {
OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(
currentEntity.getIRI(),
annot);
changes.add(new AddAxiom(ontology, axiom));
}
modelManager.applyChanges(changes);
}
示例15: insertAxiomIntoOntology
import org.semanticweb.owlapi.model.AddAxiom; //导入依赖的package包/类
/**
* @param manager
* @param ontology
* @param newOwlAxiom
*/
public static void insertAxiomIntoOntology(
OWLOntologyManager manager,
OWLOntology ontology, OWLAxiom newOwlAxiom) {
try {
if (newOwlAxiom != null) {
AddAxiom addAxiom = new AddAxiom(ontology,
newOwlAxiom);
if (addAxiom != null) {
manager.applyChange(addAxiom);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}