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


Java OWLClassAssertionAxiom类代码示例

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


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

示例1: createIndividualInternal

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
private static Pair<OWLNamedIndividual, Set<OWLAxiom>> createIndividualInternal(IRI iri, OWLOntology abox, OWLClassExpression ce, Set<OWLAnnotation> annotations) {
	LOG.info("Generating individual for IRI: "+iri);
	OWLDataFactory f = abox.getOWLOntologyManager().getOWLDataFactory();
	OWLNamedIndividual i = f.getOWLNamedIndividual(iri);
	
	// create axioms
	Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
	// declaration
	axioms.add(f.getOWLDeclarationAxiom(i));
	// annotation assertions
	if(annotations != null) {
		for(OWLAnnotation annotation : annotations) {
			axioms.add(f.getOWLAnnotationAssertionAxiom(iri, annotation));
		}
	}
	
	if (ce != null) {
		OWLClassAssertionAxiom typeAxiom = createType(f, i, ce);
		if (typeAxiom != null) {
			axioms.add(typeAxiom);
		}
	}
	
	return Pair.of(i, axioms);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:26,代码来源:CoreMolecularModelManager.java

示例2: addNegatedAttributeToObject

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的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;
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:26,代码来源:ELIndividualContext.java

示例3: addIndividualToOntology

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的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;
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:26,代码来源:IndividualContext.java

示例4: addAttributeToObject

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的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;
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:23,代码来源:IndividualContext.java

示例5: addNegatedAttributeToObject

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的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;
}
 
开发者ID:julianmendez,项目名称:ontocomplib,代码行数:23,代码来源:IndividualContext.java

示例6: undo

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的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

示例7: getTypes

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
    ensurePrepared();
    DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
    for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
        for (OWLClassAssertionAxiom axiom : ontology.getClassAssertionAxioms(ind)) {
            OWLClassExpression ce = axiom.getClassExpression();
            if (!ce.isAnonymous()) {
                result.addNode(classHierarchyInfo.getEquivalents(ce.asOWLClass()));
                if (!direct) {
                    result.addAllNodes(getSuperClasses(ce, false).getNodes());
                }
            }
        }
    }
    return result;
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:17,代码来源:StructuralReasoner2.java

示例8: isSatisfiable

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public boolean isSatisfiable(OWLClassExpression classExpression) {
	checkPreConditions(classExpression);
	if (!isConsistent())
		return false;
	if (classExpression instanceof OWLClass
			&& m_atomicConceptHierarchy != null) {
		AtomicConcept concept = H((OWLClass) classExpression);
		HierarchyNode<AtomicConcept> node = m_atomicConceptHierarchy
				.getNodeForElement(concept);
		return node != m_atomicConceptHierarchy.getBottomNode();
	} else {
		OWLDataFactory factory = getDataFactory();
		OWLIndividual freshIndividual = factory
				.getOWLAnonymousIndividual("fresh-individual");
		OWLClassAssertionAxiom assertClassExpression = factory
				.getOWLClassAssertionAxiom(classExpression, freshIndividual);
		Tableau tableau = getTableau(assertClassExpression);
		return tableau.isSatisfiable(true, null, null, null, null, null,
				ReasoningTaskDescription
						.isConceptSatisfiable(classExpression));
	}
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:23,代码来源:Reasoner.java

示例9: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public Boolean visit(OWLDatatypeDefinitionAxiom axiom) {
    reasoner.throwInconsistentOntologyExceptionIfNecessary();
    if (!reasoner.isConsistent())
        return true;
    if (reasoner.m_dlOntology.hasDatatypes()) {
        OWLDataFactory factory=reasoner.getDataFactory();
        OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual");
        OWLDataProperty freshDataProperty=factory.getOWLDataProperty(IRI.create("fresh-data-property"));
        OWLDataRange dataRange=axiom.getDataRange();
        OWLDatatype dt=axiom.getDatatype();
        OWLDataIntersectionOf dr1=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dataRange),dt);
        OWLDataIntersectionOf dr2=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dt),dataRange);
        OWLDataUnionOf union=factory.getOWLDataUnionOf(dr1,dr2);
        OWLClassExpression c=factory.getOWLDataSomeValuesFrom(freshDataProperty,union);
        OWLClassAssertionAxiom ax=factory.getOWLClassAssertionAxiom(c,freshIndividual);
        Tableau tableau=reasoner.getTableau(ax);
        return !tableau.isSatisfiable(true,true,null,null,null,null,null,ReasoningTaskDescription.isAxiomEntailed(axiom));
    }
    else
        return false;
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:22,代码来源:EntailmentChecker.java

示例10: removeDangningAnnotations

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
@CLIMethod("--remove-dangling-annotations")
public void removeDangningAnnotations(Opts opts) throws Exception {
	OWLOntology ont = g.getSourceOntology();
	int n = 0;
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
		for (OWLClassAssertionAxiom ca : ont.getClassAssertionAxioms(i)) {
			OWLClassExpression cx = ca.getClassExpression();
			if (cx instanceof OWLClass) {
				OWLClass c = (OWLClass) cx;
				String label = g.getLabel(c);
				if (label == null)
					rmAxioms.add(ca);
				else
					n++;
			}
		}
	}
	LOG.info("Removing " + rmAxioms.size() + " axioms");
	ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
	LOG.info("Remaining: " + n + " axioms");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:Sim2CommandRunner.java

示例11: materializeClassExpressionsReferencedBy

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public Set<OWLClass> materializeClassExpressionsReferencedBy(OWLObjectProperty p) {
	Set<OWLClassExpression> xs = new HashSet<OWLClassExpression>();
	for (OWLAxiom ax : outputOntology.getReferencingAxioms(p, Imports.INCLUDED)) {
		if (ax instanceof OWLSubClassOfAxiom) {
			xs.addAll(getClassExpressionReferencedBy(p, ((OWLSubClassOfAxiom)ax).getSuperClass()));
		}
		else if (ax instanceof OWLClassAssertionAxiom) {
			xs.addAll(getClassExpressionReferencedBy(p, ((OWLClassAssertionAxiom)ax).getClassExpression()));
		}
		else if (ax instanceof OWLEquivalentClassesAxiom) {
			for (OWLClassExpression x : ((OWLEquivalentClassesAxiom)ax).getClassExpressions()) {
				xs.addAll(getClassExpressionReferencedBy(p,x));
			}
		}
	}
	return materializeClassExpressions(xs);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:AbstractSimPreProcessor.java

示例12: randomizeClassAssertions

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public static void randomizeClassAssertions(OWLOntology ont, int num) {
	Set<OWLClassAssertionAxiom> caas = new HashSet<OWLClassAssertionAxiom>();
	Set<OWLClassAssertionAxiom> caasNew = new HashSet<OWLClassAssertionAxiom>();
		Set<OWLNamedIndividual> inds = ont.getIndividualsInSignature(Imports.INCLUDED);
	OWLNamedIndividual[] indArr = (OWLNamedIndividual[]) inds.toArray();
	for (OWLNamedIndividual ind : inds) {
		caas.addAll( ont.getClassAssertionAxioms(ind) );
	}
	for (OWLClassAssertionAxiom caa : caas) {
		OWLIndividual randomIndividual = null;
		caasNew.add(ont.getOWLOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(caa.getClassExpression(), 
				randomIndividual));
	}
	ont.getOWLOntologyManager().removeAxioms(ont, caas);
	ont.getOWLOntologyManager().addAxioms(ont, caasNew);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:ABoxUtils.java

示例13: makeHasPhenotypeInstancesDirect

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
protected void makeHasPhenotypeInstancesDirect() {
	// x Type has_phenotype some C ==> x Type C
	LOG.info("x Type has_phenotype some C ==> x Type C");
	OWLObjectProperty hasPhenotype = getOWLObjectPropertyViaOBOSuffix(HAS_PHENOTYPE);
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
	for (OWLClassAssertionAxiom caa : outputOntology.getAxioms(AxiomType.CLASS_ASSERTION)) {
		OWLClassExpression ex = caa.getClassExpression();
		OWLIndividual i = caa.getIndividual();
		if (ex instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)ex;
			if (svf.getProperty().equals(hasPhenotype)) {
				rmAxioms.add(caa);
				newAxioms.add(getOWLDataFactory().getOWLClassAssertionAxiom(svf.getFiller(), i));
			}

		}
	}
	LOG.info("making instances direct: +"+newAxioms.size()+ " -"+rmAxioms.size());
	addAxiomsToOutput(newAxioms, false);
	removeAxiomsFromOutput(rmAxioms, false);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:PhenoSimHQEPreProcessor.java

示例14: visit

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
public void visit(OWLClassAssertionAxiom classAssertion) {
	OWLIndividual individual = classAssertion.getIndividual();
	OWLClassExpression classExpression = classAssertion.getClassExpression();
	
	if (!classExpression.isAnonymous()) {
		OWLClass namedClass = classExpression.asOWLClass();
		
		writer.print(namedClass.getIRI().getFragment());
		writer.print("(");
		writer.print(IRI.create(individual.toStringID()).getFragment());
		writer.print(").\n");
	}
	else {
		
	}
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:17,代码来源:NiceAxiomPrinter.java

示例15: createIndividual

import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; //导入依赖的package包/类
/**
 * Create an individual of a given type
 * 
 * @param individual
 *            the individual signature
 * @param type
 *            individual type
 */

public void createIndividual(final String individual, final String type) {
	OWLDataFactory factory = ontology.getOWLOntologyManager()
			.getOWLDataFactory();

	OWLClass clazz = factory.getOWLClass(IRI.create(type));

	OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI
			.create(individual));
	OWLClassAssertionAxiom assertion = factory.getOWLClassAssertionAxiom(
			clazz, ind);
	final List<OWLOntologyChange> owlOntologyChanges = ontology
			.getOWLOntologyManager().addAxiom(ontology, assertion);
	manager.applyChanges(owlOntologyChanges);
	reasoner.flush();
}
 
开发者ID:edlectrico,项目名称:Pellet4Android,代码行数:25,代码来源:OntologyManager.java


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