• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OWLClassExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createIndividualInternal

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

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
/**
 * Replace inx using m
 * 
 * @param inx
 * @param m
 * @return
 */
private OWLClassExpression replace(OWLClassExpression inx,
		Mapping m) {

	LOG.info("Testing: "+inx+" for mapping using "+m);
	// test to see if there is a match between the src pattern in
	// the mapping and the input expression
	BindingSet bset = unifyAll(inx, m.src, m.vars);
	if (bset == null) {
		// no match
		LOG.info("No match for: "+inx);
		return null;
	}
	LOG.info("Unified. Bindings: "+bset);
	return replaceVariables(inx, bset);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:TemplatedTransformer.java


示例3: buildSimpleDefMap

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
private void buildSimpleDefMap() {
	simpleDefMap = new HashMap<OWLClass,Set<OWLClassExpression>>();
	OWLOntology o = getGraph().getSourceOntology();
	for (OWLClass c : o.getClassesInSignature()) {
		for (OWLEquivalentClassesAxiom eca : o.getEquivalentClassesAxioms(c)) {
			Set<OWLClassExpression> elts = new HashSet<OWLClassExpression>();
			for (OWLClassExpression x : eca.getClassExpressions()) {
				// assume one logical definitionper class - otherwise choose arbitrary
				if (x instanceof OWLObjectIntersectionOf) {
					if (getReachableOWLClasses(x, elts) && elts.size() > 0) {
						//LOG.info(c+" def= "+elts);
						simpleDefMap.put(c, elts);						
					}
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:19,代码来源:CompositionalClassPredictor.java


示例4: makeExpression

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
public Expression makeExpression(OWLClassExpression x) {
	if (x.isAnonymous()) {
		if (x instanceof OWLObjectIntersectionOf) {
			return makeIntersectionOf((OWLObjectIntersectionOf)x);
		}
		else if (x instanceof OWLObjectSomeValuesFrom) {
			return makeSomeValuesFrom((OWLObjectSomeValuesFrom)x);
		}
		else {
			return null;
		}
	}
	else {
		return makeClassStub(x);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:FrameMaker.java


示例5: visit

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
@Override
public HandlerResult visit(OWLObjectMaxCardinality ce) {
	if (ce.getCardinality() == 0) {
		// remove the ce if the max cardinality is zero
		return HandlerResult.remove();
	}
	final OWLClassExpression filler = ce.getFiller();
	final HandlerResult recursive = filler.accept(this);
	OWLObjectSomeValuesFrom newCE;
	if (recursive == null) {
		newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), filler);
	}
	else if (recursive.remove) {
		return HandlerResult.remove();
	}
	else {
		newCE = factory.getOWLObjectSomeValuesFrom(ce.getProperty(), recursive.modified);
	}
	return HandlerResult.modified(newCE);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:CardinalityContraintsTools.java


示例6: handleIntersection

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
private void handleIntersection(List<CheckWarning> warnings, Set<OWLOntology> allOntologies,
		OWLEquivalentClassesAxiom axiom, OWLObjectIntersectionOf intersection, OWLPrettyPrinter pp) 
{
	for(OWLClassExpression operand : intersection.getOperandsAsList()) {
		OWLClass operandCls = null;
		if (!operand.isAnonymous()) {
			operandCls = operand.asOWLClass();
		}
		else if (operand instanceof OWLObjectSomeValuesFrom) {
			OWLObjectSomeValuesFrom ristriction = (OWLObjectSomeValuesFrom) operand;
			OWLClassExpression filler = ristriction.getFiller();
			if (!filler.isAnonymous()) {
				operandCls = filler.asOWLClass();
			}
		}
		else {
			// not translatable to OBO
			handleGeneric(warnings, allOntologies, axiom, operand, pp);
		}
		if (operandCls != null && isDangling(operandCls, allOntologies)) {
			final IRI iri = operandCls.getIRI();
			String message = "Dangling reference "+iri+" in INTERSECTION_OF axiom: "+pp.render(axiom);
			warnings.add(new CheckWarning(getID(), message , isFatal(), iri, OboFormatTag.TAG_INTERSECTION_OF.getTag()));
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:DanglingReferenceCheck.java


示例7: visit

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
public void visit(OWLDataPropertyAssertionAxiom axiom) {
    if (!axiom.getSubject().isAnonymous()) {
        return; // not interesting for the anonymous individual forest
    }
    OWLAnonymousIndividual sub=axiom.getSubject().asOWLAnonymousIndividual();
    nodes.add(sub);
    OWLClassExpression c=factory.getOWLDataHasValue(axiom.getProperty(),axiom.getObject());
    if (nodelLabels.containsKey(sub)) {
        nodelLabels.get(sub).add(c);
    }
    else {
        Set<OWLClassExpression> labels=new HashSet<OWLClassExpression>();
        labels.add(c);
        nodelLabels.put(sub,labels);
    }
}
 
开发者ID:evalincius,项目名称:Hermit_1.3.8_android,代码行数:17,代码来源:EntailmentChecker.java


示例8: getSuperClassExpressions

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
/**
 * note that this is not a standard reasoner method
 * 
 * @param ce
 * @param direct
 * @return all superclasses, where superclasses can include anon class expressions
 * @throws InconsistentOntologyException
 * @throws ClassExpressionNotInProfileException
 * @throws FreshEntitiesException
 * @throws ReasonerInterruptedException
 * @throws TimeOutException
 */
public Set<OWLClassExpression> getSuperClassExpressions(OWLClassExpression ce,
		boolean direct) throws InconsistentOntologyException,
		ClassExpressionNotInProfileException, FreshEntitiesException,
		ReasonerInterruptedException, TimeOutException {

	Set<OWLClassExpression> result = new HashSet<OWLClassExpression>();
	Set<OWLObject> supers = gw.getSubsumersFromClosure(ce);
	for (OWLObject sup : supers) {
		if (sup instanceof OWLClassExpression) {
			result.add((OWLClassExpression) sup);
		}
		else {

		}
	}
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:30,代码来源:GraphReasoner.java


示例9: findDescendants

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
protected Set<OWLClass> findDescendants(OWLReasoner r, String expr, Integer numExpected) throws TimeOutException, FreshEntitiesException, InconsistentOntologyException, ClassExpressionNotInProfileException, ReasonerInterruptedException, OWLParserException {
	System.out.println("Query: "+expr);
	OWLClassExpression qc = parseOMN(expr);
	Set<OWLClass> clzs = r.getSubClasses(qc, false).getFlattened();
	clzs.remove(r.getRootOntology().getOWLOntologyManager().getOWLDataFactory().getOWLNothing());
	if (!qc.isAnonymous())
		clzs.add((OWLClass) qc);
	System.out.println("NumD:"+clzs.size());
	for (OWLClass c : clzs) {
		System.out.println("  D:"+c);
	}
	if (numExpected != null) {
		assertEquals(numExpected.intValue(), clzs.size());
	}
	return clzs;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:AbstractReasonerTest.java


示例10: testParseClazzNoCheckLiteralIds

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
@Test
public void testParseClazzNoCheckLiteralIds() throws Exception {
    
    JsonOwlObject expression = new JsonOwlObject();
    expression.type = JsonOwlObjectType.Class;
    expression.id = "GO:23"; // valid prefix, not a known class
    
    // create a parser that explicitly disables checking so-called literal ids 
    OWLClassExpression ce = new M3ExpressionParser(false, curieHandler).parse(graph, expression, null);
    
    // check the retrieved class is the same as the input
    // note: we don't use the owltools getClass method directly, as that depends on the class
    // being known
    IRI iri = graph.getIRIByIdentifier("GO:23");
    assertEquals(iri, ce.asOWLClass().getIRI());
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:17,代码来源:M3ExpressionParserTest.java


示例11: getSuperClasses

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
		boolean direct) throws InconsistentOntologyException,
		ClassExpressionNotInProfileException, FreshEntitiesException,
		ReasonerInterruptedException, TimeOutException {

	DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
	Set<OWLObject> supers = gw.getSubsumersFromClosure(ce);
	for (OWLObject sup : supers) {
		if (sup instanceof OWLClassExpression) {
			if (sup instanceof OWLClass) {
				result.addEntity((OWLClass) sup);
			}
			else {

			}
		}
		else {

		}
	}
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:GraphReasoner.java


示例12: getOneOfAuxiliaryClass

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
/**
 * For a One-of Object {a,b,c,...} create and auxiliary class oo1, and
 * and axiom <code>oo1 subSetOf guard_i_a or guard_i_b or ...</code>
 * @param objectOneOf
 * @return
 */
private OWLClass getOneOfAuxiliaryClass(OWLObjectOneOf objectOneOf) {
	if (oneOfAuxClasses.containsKey(objectOneOf))
		return oneOfAuxClasses.get(objectOneOf);

	OWLClass auxOneOf = new OWLClassImpl(IRI.create(INTERNAL_IRI_PREFIX + "#oneOfaux" + (oneOfAuxClasses.size()+1)));
	OWLClassExpression[] inclusion = new OWLClassExpression[2];

	inclusion[0] = new OWLObjectComplementOfImpl(auxOneOf);
	inclusion[1] = objectOneOf;

	//translateInclusion(inclusion);
	newInclusions.add(inclusion);

	// add to the set of class which needs to be guessed
	// auxClasses.add(auxOneOf);
	oneOfAuxClasses.put(objectOneOf, auxOneOf);
	return auxOneOf;
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:25,代码来源:DebugTranslation.java


示例13: visit

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
public OWLClassExpression visit(OWLObjectOneOf object) {
     	//CHANGED
OWLClass definition=getDefinitionForNegativeNominal(object,m_alreadyExists);
if (!m_alreadyExists[0]) {
    for (OWLIndividual individual : object.getIndividuals()) {
        addFact(m_factory.getOWLClassAssertionAxiom(definition,individual));
    }
}
return definition;
         /*
         for (OWLIndividual ind : object.getIndividuals())
             if (ind.isAnonymous())
                 throw new IllegalArgumentException("Error: The class expression "+object+" contains anonymous individuals, which is not allowed in OWL 2 (erratum in first OWL 2 spec, to be fixed with next publication of minor corrections). ");
         return object;
         */
     }
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:17,代码来源:OWLNormalization.java


示例14: parse

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
static OWLClassExpression parse(OWLGraphWrapper g, JsonOwlObject[] expressions, JsonOwlObjectType type)
		throws Exception {
	if (expressions.length == 0) {
		throw new Exception("Missing expressions: empty expression list is not allowed.");
	}
	if (expressions.length == 1) {
		return parse(g, expressions[0]);	
	}
	Set<OWLClassExpression> clsExpressions = new HashSet<OWLClassExpression>();
	for (JsonOwlObject m3Expression : expressions) {
		OWLClassExpression ce = parse(g, m3Expression);
		clsExpressions.add(ce);
	}
	if (type == JsonOwlObjectType.UnionOf) {
		return g.getDataFactory().getOWLObjectUnionOf(clsExpressions);
	}
	else if (type == JsonOwlObjectType.IntersectionOf) {
		return g.getDataFactory().getOWLObjectIntersectionOf(clsExpressions);
	}
	else {
		throw new UnknownIdentifierException("Unsupported expression type: "+type);
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:24,代码来源:MolecularModelJsonRendererTest.java


示例15: removeDangningAnnotations

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


示例16: UnfoldingVisitor

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
UnfoldingVisitor(Set<OWLClass> unfoldClasses, OWLOntology ontology) throws NonDeterministicUnfoldException {
	this.unfoldClasses = new HashMap<OWLClass, OWLClassExpression>();
	factory = ontology.getOWLOntologyManager().getOWLDataFactory();
	
	for(OWLClass owlClass : unfoldClasses) {
		Set<OWLEquivalentClassesAxiom> eqAxioms = ontology.getEquivalentClassesAxioms(owlClass);
		if (eqAxioms != null && !eqAxioms.isEmpty()) {
			if(eqAxioms.size() > 1) {
				throw new NonDeterministicUnfoldException("Non deterministic unfold for class: "+owlClass.getIRI());
			}
			OWLEquivalentClassesAxiom eqAxiom = eqAxioms.iterator().next();
			Set<OWLClassExpression> expressions = eqAxiom.getClassExpressionsMinus(owlClass);
			if (expressions.size() == 1) {
				this.unfoldClasses.put(owlClass, expressions.iterator().next());
			}
			else if (expressions.size() > 1) {
				OWLClassExpression ce = factory.getOWLObjectIntersectionOf(expressions);
				this.unfoldClasses.put(owlClass, ce);
			}
		}
	}
	
	// TODO check that there are no cycles in the unfold expressions, otherwise this unfold will not terminate!
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:TBoxUnFoldingTool.java


示例17: renderAdditionalNodeExpression

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp) {
	if (expression instanceof OWLObjectSomeValuesFrom) {
		OWLObjectSomeValuesFrom object = (OWLObjectSomeValuesFrom) expression;
		OWLObjectPropertyExpression property = object.getProperty();
		OWLClassExpression filler = object.getFiller();
		line.append("<TR><TD>");
		line.append(getLabel(property, owlpp));
		line.append("</TD><TD>");
		line.append(getLabel(filler, owlpp));
		line.append("</TD></TR>");
	}
	else {
		line.append("<TR><TD COLSPAN=\"2\">");
		line.append(getLabel(expression, owlpp));
		line.append("</TD></TR>");
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:LegoDotWriter.java


示例18: addAutoGeneratedClassNames

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
private void addAutoGeneratedClassNames(OWLOntologyManager manager,
										OWLOntology ontology,
										Map<String, OWLClassExpression> nameMap) {
	
	OWLDataFactory factory = manager.getOWLDataFactory();
	List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
	
	for (Map.Entry<String, OWLClassExpression> entry : nameMap.entrySet()) {
		
		OWLClass subClass = factory.getOWLClass( IRI.create(entry.getKey()) );
		OWLAxiom declAxiom = factory.getOWLEquivalentClassesAxiom( subClass, entry.getValue() );
		
		changes.addAll( manager.addAxiom( ontology, declAxiom ) );
	}
	
	manager.applyChanges( changes );
}
 
开发者ID:klinovp,项目名称:pronto,代码行数:18,代码来源:KBEmbeddedLoader.java


示例19: emptyDisjointUnion

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
@Test
public void emptyDisjointUnion() throws Exception {
	OWLOntologyManager owlManager = OWLManager
			.createConcurrentOWLOntologyManager();
	// creating an ontology
	final OWLOntology ontology = owlManager.createOntology();
	OWLClass a = factory.getOWLClass(IRI.create("http://example.org/A"));
	OWLClass b = factory.getOWLClass(IRI.create("http://example.org/B"));
	// DisjointUnion(A ) = EquivalentClasses(A owl:Nothing)
	owlManager.addAxiom(ontology, factory.getOWLDisjointUnionAxiom(a,
			Collections.<OWLClassExpression> emptySet()));
	owlManager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(b, b));

	final OWLProver prover = OWLAPITestUtils.createProver(ontology);

	prover.precomputeInferences(InferenceType.CLASS_HIERARCHY);

	ProofTestUtils.provabilityTest(prover,
			factory.getOWLSubClassOfAxiom(a, b));
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:21,代码来源:ProofTest.java


示例20: generateAssociations

import org.semanticweb.owlapi.model.OWLClassExpression; //导入依赖的package包/类
public Set<GeneAnnotation> generateAssociations(OWLNamedIndividual ind, OWLOntology ont) {
	Set<GeneAnnotation> assocs = new HashSet<GeneAnnotation>();
	String eid = graph.getIdentifier(ind);
	for (OWLClassExpression x : OwlHelper.getTypes(ind, ont)) {
		GeneAnnotation ga = new GeneAnnotation();
		if (x.isAnonymous()) {
			// TODO
		}
		else {
			ga.setCls(graph.getIdentifier(x));
		}
		ga.setBioentity(eid);
		assocs.add(ga);
	}
	return assocs;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:SimpleABoxToGAF.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DocumentResult类代码示例发布时间:2022-05-21
下一篇:
Java AttributesMapper类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap