当前位置: 首页>>代码示例>>Java>>正文


Java RemoveAxiom类代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.RemoveAxiom的典型用法代码示例。如果您正苦于以下问题:Java RemoveAxiom类的具体用法?Java RemoveAxiom怎么用?Java RemoveAxiom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoveAxiom类属于org.semanticweb.owlapi.model包,在下文中一共展示了RemoveAxiom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeAnnotation

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
/** Removes the set annotations of the entity from the given ontology using the given manager.
 * @param modelManager
 * @param currentEntity
 * @param ontology
 * @param annotations
 */
public static void removeAnnotation(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 RemoveAxiom(ontology, axiom));
	}
	modelManager.applyChanges(changes);
}
 
开发者ID:ics-upmc,项目名称:archonte,代码行数:23,代码来源:ArchonteUtils.java

示例2: undo

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
public void undo() {
	OWLClassAssertionAxiom axiom = null;
	if (isTypePlus) {
		axiom = theContext.getFactory().getOWLClassAssertionAxiom(changedType, candidate);
	}
	else {
		axiom = theContext.getFactory().getOWLClassAssertionAxiom( 
				theContext.getFactory().getOWLObjectComplementOf(changedType), candidate);
	}
	RemoveAxiom  removeAxiom = new RemoveAxiom(theContext.getOntology(),axiom); 
	try {
		theContext.getManager().applyChange(removeAxiom);
	}
	catch (OWLOntologyChangeException e) {
		e.printStackTrace();
		System.exit(-1);
	}
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:19,代码来源:CounterExampleCandidateDescriptionChange.java

示例3: removeRedundantAxioms

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
void removeRedundantAxioms() {
  final List<RemoveAxiom> changes = new ArrayList<RemoveAxiom>();
  Set<OWLClass> allClasses = ont.getClassesInSignature(true);
  logger.info("Check classes for redundant super class axioms, all OWL classes count: " + allClasses.size());
  for (OWLClass cls: allClasses) {
    final Set<OWLClass> directSuperClasses = reasoner.getSuperClasses(cls, true).getFlattened();
    for (final OWLOntology importedOntology: ont.getImportsClosure()) {
      Set<OWLSubClassOfAxiom> subClassAxioms = importedOntology.getSubClassAxiomsForSubClass(cls);
      for (final OWLSubClassOfAxiom subClassAxiom : subClassAxioms) {
        subClassAxiom.getSuperClass().accept(new OWLClassExpressionVisitorAdapter(){
          @Override
          public void visit(OWLClass desc) {
            if (directSuperClasses.contains(desc) == false) {
              changes.add(new RemoveAxiom(importedOntology, subClassAxiom));
            }
          }
        });
      }
    }
  }
  logger.info("Found redundant axioms: " + changes.size());
  List<OWLOntologyChange> result = manager.applyChanges(changes);
  logger.info("Removed axioms: " + result.size());
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:25,代码来源:ReasonerUtil.java

示例4: undo

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
public void undo() {
	RemoveAxiom removeAxiom = new RemoveAxiom(getContext().getOntology(),
			getChange().getAxiom());
	try {
		getContext().getManager().applyChange(removeAxiom);
		// context.reClassifyOntology();
	}
	catch (OWLOntologyChangeException e) {
		e.printStackTrace();
		System.exit(-1);
	}
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:13,代码来源:AbstractContextModification.java

示例5: modifyAnnotations

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
private OWLObjectPropertyAssertionAxiom modifyAnnotations(OWLObjectPropertyAssertionAxiom axiom, 
		Set<OWLAnnotation> replacement, 
		ModelContainer model, METADATA metadata) {
	OWLOntology ont = model.getAboxOntology();
	OWLDataFactory f = model.getOWLDataFactory();
	List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(2);
	changes.add(new RemoveAxiom(ont, axiom));
	OWLObjectPropertyAssertionAxiom newAxiom = 
			f.getOWLObjectPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), axiom.getObject(), replacement);
	changes.add(new AddAxiom(ont, newAxiom));
	applyChanges(model, changes, metadata);
	return newAxiom;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:14,代码来源:CoreMolecularModelManager.java

示例6: removeAxiom

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
void removeAxiom(ModelContainer model, OWLAxiom axiom, METADATA metadata) {
	OWLOntology ont = model.getAboxOntology();
	List<OWLOntologyChange> changes = Collections.<OWLOntologyChange>singletonList(new RemoveAxiom(ont, axiom));
	synchronized (ont) {
		/*
		 * all changes to the ontology are synchronized via the ontology object
		 */
		applyChanges(model, ont.getOWLOntologyManager(), changes, metadata);
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:11,代码来源:CoreMolecularModelManager.java

示例7: removeAxioms

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
void removeAxioms(ModelContainer model, Set<OWLAxiom> axioms, METADATA metadata) {
	OWLOntology ont = model.getAboxOntology();
	List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(axioms.size());
	for(OWLAxiom axiom : axioms) {
		changes.add(new RemoveAxiom(ont, axiom));
	}
	synchronized (ont) {
		/*
		 * all changes to the ontology are synchronized via the ontology object
		 */
		applyChanges(model, ont.getOWLOntologyManager(), changes, metadata);
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:14,代码来源:CoreMolecularModelManager.java

示例8: loadDefaultConstraintsFromOWL

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
/**
 * Loads conditional constraints from an ontology with annotated axioms
 * 
 * @param ontology
 * @param signature 
 * @param declAxioms Used to return declaration axioms for auto-generated class names
 * @param iriPrefix IRI prefix for auto-generated class names
 * @param raxList
 * @return
 */
public static Set<ConditionalConstraint> loadDefaultConstraintsFromOWL(
		OWLOntology ontology,
		Map<String, OWLClassExpression> nameMap,
		Set<OWLEntity> signature,
		List<RemoveAxiom> raxList, String iriPrefix,
		OWLOntologyManager manager) {

	Set<ConditionalConstraint> ccSet = new HashSet<ConditionalConstraint>();
	//Begin with generic (default) subclass-of axioms
	for( OWLAxiom axiom : ontology.getAxioms( AxiomType.SUBCLASS_OF ) ) {
		for( OWLAnnotation annotation : axiom.getAnnotations() ) {

			if( Constants.CERTAINTY_ANNOTATION_URI.equals(annotation.getProperty().getIRI().toURI() ) ) {

				OWLSubClassOfAxiom sbAxiom = (OWLSubClassOfAxiom) axiom;
				String subClassIRI = generateClassName(sbAxiom.getSubClass(), nameMap, iriPrefix);
				String superClassIRI = generateClassName(sbAxiom.getSuperClass(), nameMap, iriPrefix);
				ConditionalConstraint cc = newConstraint(subClassIRI, superClassIRI, annotation.getValue().toString());

				signature.addAll( sbAxiom.getSubClass().getClassesInSignature() );
				signature.addAll( sbAxiom.getSuperClass().getClassesInSignature() );
				
				if( null != cc ) {

					ccSet.add( cc );

					if( null != raxList ) {
						raxList.add( new RemoveAxiom( ontology, axiom ) );
					}
				}
			}
		}
	}

	return ccSet;
}
 
开发者ID:klinovp,项目名称:pronto,代码行数:47,代码来源:ProntoLoaderUtils.java

示例9: getPendingAxiomRemovals

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
public Set<OWLAxiom> getPendingAxiomRemovals() {
	Set<OWLAxiom> removed = new HashSet<OWLAxiom>();
	for (OWLOntologyChange change : m_pendingChanges)
		if (change instanceof RemoveAxiom)
			removed.add(change.getAxiom());
	return removed;
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:8,代码来源:Reasoner.java

示例10: getPendingAxiomRemovals

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
Set<OWLAxiom> getPendingAxiomRemovals() {
	Set<OWLAxiom> removed = new HashSet<OWLAxiom>();
	for (OWLOntologyChange change : pendingChanges_) {
		if (change instanceof RemoveAxiom) {
			removed.add(change.getAxiom());
		}
	}
	return removed;
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:10,代码来源:OwlChangesLoaderFactory.java

示例11: removeSubsetEntities

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
@CLIMethod("--remove-subset-entities")
public void removeSubsetEntities(Opts opts) throws Exception {
    opts.info("[SUBSET]+","Removes all classes, individuals and object properties that are in the specific subset(s)");
    List<String> subSets = opts.nextList();
    if (subSets == null || subSets.isEmpty()) {
        System.err.println("At least one subset is required for this function.");
        exit(-1);
    }
    // create annotation values to match
    Set<OWLAnnotationValue> values = new HashSet<OWLAnnotationValue>();
    OWLDataFactory f = g.getDataFactory();
    for(String subSet : subSets) {
        // subset as plain string
        values.add(f.getOWLLiteral(subSet));
        // subset as IRI
        values.add(IRI.create(Obo2OWLConstants.DEFAULT_IRI_PREFIX+"#"+subSet));
    }

    // get annotation property for subset
    OWLAnnotationProperty p = g.getAnnotationProperty(OboFormatTag.TAG_SUBSET.getTag());

    // collect all objects in the given subset
    final Set<OWLObject> entities = Mooncat.findTaggedEntities(p, values, g);
    LOG.info("Found "+entities.size()+" tagged objects.");

    if (entities.isEmpty() == false) {
        final List<RemoveAxiom> changes = Mooncat.findRelatedAxioms(entities, g);
        if (changes.isEmpty() == false) {
            LOG.info("applying changes to ontology, count: "+changes.size());
            g.getManager().applyChanges(changes);
        }
        else {
            LOG.info("No axioms found for removal.");
        }
    }
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:37,代码来源:CommandRunner.java

示例12: tr

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
public Set<OWLOntologyChange> tr(OWLAxiom inAxiom, Mapping m) {
	Set<OWLOntologyChange> chgs = new HashSet<OWLOntologyChange>();
	boolean isModified = false;
	OWLAxiom newAxiom = null;
	if (inAxiom instanceof OWLEquivalentClassesAxiom) {
		OWLEquivalentClassesAxiom aa = (OWLEquivalentClassesAxiom)inAxiom;
		Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>();
		for (OWLClassExpression x : aa.getClassExpressions()) {
			OWLClassExpression x2 = replace(x, m);
			if (x2 == null) {
				xs.add(x);
			}
			else {
				isModified = true;
				xs.add(x2);
				LOG.info("  TR : "+x+ " ---> "+x2);
			}
		}
		if (isModified) {
			newAxiom = getOWLDataFactory().getOWLEquivalentClassesAxiom(xs);
		}
	}
	if (isModified) {
		if (m.isReplace) {
			chgs.add(new RemoveAxiom(ontology, inAxiom));
		}
		chgs.add(new AddAxiom(ontology, newAxiom));
	}
	return chgs;
	
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:32,代码来源:TemplatedTransformer.java

示例13: removeInferredAxioms

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
/**
 * Remove inferred axioms, which are marked by the appropriate axiom annotation. 
 * 
 * @param removedSubClassOfAxioms
 * @param removedSubClassOfAxiomChanges
 * 
 * @see AxiomAnnotationTools#isMarkedAsInferredAxiom(OWLAxiom)
 */
private void removeInferredAxioms(Set<OWLSubClassOfAxiom> removedSubClassOfAxioms, Set<RemoveAxiom> removedSubClassOfAxiomChanges)
{
	final OWLOntology ont = mooncat.getGraph().getSourceOntology();
	for (OWLSubClassOfAxiom a : ont.getAxioms(AxiomType.SUBCLASS_OF)) {
		if (AxiomAnnotationTools.isMarkedAsInferredAxiom(a)) {
			RemoveAxiom rmax = new RemoveAxiom(ont, a);
			removedSubClassOfAxiomChanges.add(rmax);
			removedSubClassOfAxioms.add(a);
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OboOntologyReleaseRunner.java

示例14: removeUnaryDisjointnessAxioms

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
/**
 * Remove unary disjointness axioms from the given ontology
 * @param ont	OWL ontology
 */
private void removeUnaryDisjointnessAxioms(OWLOntology ont) {
	List<RemoveAxiom> toRemove = new ArrayList<RemoveAxiom>();
	for(OWLAxiom ax : ont.getAxioms(AxiomType.DISJOINT_CLASSES)) {
		OWLDisjointClassesAxiom dis = (OWLDisjointClassesAxiom)ax;
		if(dis.getClassesInSignature().size() < 2)
			toRemove.add(new RemoveAxiom(ont, ax));
	}
	ont.getOWLOntologyManager().applyChanges(toRemove);
}
 
开发者ID:rsgoncalves,项目名称:ecco,代码行数:14,代码来源:Ecco.java

示例15: removeAbox

import org.semanticweb.owlapi.model.RemoveAxiom; //导入依赖的package包/类
/**
 * Remove Abox axioms from given ontology
 * @param ont	Ontology to remove Abox axioms from
 */
private void removeAbox(OWLOntology ont) {
	Set<OWLAxiom> aboxAxs = ont.getABoxAxioms(true);
	List<RemoveAxiom> toRemove = new ArrayList<RemoveAxiom>();
	for(OWLAxiom ax : aboxAxs)
		toRemove.add(new RemoveAxiom(ont, ax));
	ont.getOWLOntologyManager().applyChanges(toRemove);
}
 
开发者ID:rsgoncalves,项目名称:ecco,代码行数:12,代码来源:Ecco.java


注:本文中的org.semanticweb.owlapi.model.RemoveAxiom类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。