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


Java OWLObjectPropertyExpression.isAnonymous方法代码示例

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


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

示例1: visit

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public void visit(SWRLObjectPropertyAtom at) {
    OWLObjectPropertyExpression ope=at.getPredicate().getSimplified();
    OWLObjectProperty op=ope.getNamedProperty();
    SWRLVariable variable1;
    SWRLVariable variable2;
    if (ope.isAnonymous()) {
        variable1=getVariableFor(at.getSecondArgument());
        variable2=getVariableFor(at.getFirstArgument());
    }
    else {
        variable1=getVariableFor(at.getFirstArgument());
        variable2=getVariableFor(at.getSecondArgument());

    }
    SWRLAtom newAtom=m_factory.getSWRLObjectPropertyAtom(op,variable1,variable2);
    if (m_isPositive) {
        // head
        m_normalizedHeadAtoms.add(newAtom);
    }
    else {
        // body
        m_normalizedBodyAtoms.add(newAtom);
    }
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:25,代码来源:OWLNormalization.java

示例2: getRoleAtom

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
protected Atom getRoleAtom(OWLObjectPropertyExpression objectProperty,Term first,Term second) {
    AtomicRole atomicRole;
    objectProperty=objectProperty.getSimplified();
    if (objectProperty.isAnonymous()) {
        OWLObjectProperty internalObjectProperty=objectProperty.getNamedProperty();
        atomicRole=AtomicRole.create(internalObjectProperty.getIRI().toString());
        Term tmp=first;
        first=second;
        second=tmp;
    }
    else
        atomicRole=AtomicRole.create(objectProperty.asOWLObjectProperty().getIRI().toString());
    if (m_allAtomicObjectRoles.contains(atomicRole))
        return Atom.create(atomicRole,first,second);
    else
        throw new IllegalArgumentException("Internal error: fresh properties in property assertions are not compatible with incremental ABox loading!");
}
 
开发者ID:robertoyus,项目名称:HermiT-android,代码行数:18,代码来源:ReducedABoxOnlyClausification.java

示例3: flattenExistentialRestriction

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
private Set<Integer> flattenExistentialRestriction(OWLObjectSomeValuesFrom existentialRestriction,
		Set<Definition> newDefinitions, Set<Integer> newNames) {
	OWLObjectPropertyExpression propertyExpr = existentialRestriction.getProperty();
	if (propertyExpr.isAnonymous()) {
		throw new RuntimeException("Unsupported object property expression: " + propertyExpr);
	}

	String roleName = propertyExpr.getNamedProperty().toStringID();
	Set<Integer> fillerIds = flattenClassExpression(existentialRestriction.getFiller(), newDefinitions, newNames);
	Integer fillerId = null;

	if (fillerIds.size() == 0) {
		// the empty conjunction is top
		fillerId = atomManager.createConceptName(top.toStringID());
	} else if (fillerIds.size() == 1) {
		fillerId = fillerIds.iterator().next();
	}

	if ((fillerId == null) || !atomManager.getAtom(fillerId).isConceptName()) {
		// if we have more than one atom id in 'fillerIds' or the only atom
		// id is not a concept name, then we need to introduce a new
		// definition in order to obtain a flat atom
		fillerId = createFreshFlatteningDefinition(fillerIds, newDefinitions);
	}

	Integer atomId = atomManager.createExistentialRestriction(roleName, fillerId);
	return Collections.singleton(atomId);
}
 
开发者ID:julianmendez,项目名称:uel,代码行数:29,代码来源:UelOntology.java

示例4: getObjectPropertyValues

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public NodeSet<OWLNamedIndividual> getObjectPropertyValues(OWLNamedIndividual ind, OWLObjectPropertyExpression pe) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
    ensurePrepared();
    OWLNamedIndividualNodeSet result = new OWLNamedIndividualNodeSet();
    Node<OWLObjectPropertyExpression> inverses = getInverseObjectProperties(pe);
    for (OWLOntology ontology : getRootOntology().getImportsClosure()) {
        for (OWLObjectPropertyAssertionAxiom axiom : ontology.getObjectPropertyAssertionAxioms(ind)) {
            if (!axiom.getObject().isAnonymous()) {
                if (axiom.getProperty().getSimplified().equals(pe.getSimplified())) {
                    if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                        result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                    }
                    else {
                        result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                    }
                }
            }
            // Inverse of pe
            if (axiom.getObject().equals(ind) && !axiom.getSubject().isAnonymous()) {
                OWLObjectPropertyExpression invPe = axiom.getProperty().getInverseProperty().getSimplified();
                if (!invPe.isAnonymous() && inverses.contains(invPe.asOWLObjectProperty())) {
                    if (getIndividualNodeSetPolicy().equals(IndividualNodeSetPolicy.BY_SAME_AS)) {
                        result.addNode(getSameIndividuals(axiom.getObject().asOWLNamedIndividual()));
                    }
                    else {
                        result.addNode(new OWLNamedIndividualNode(axiom.getObject().asOWLNamedIndividual()));
                    }
                }
            }

        }
    }
    // Could do other stuff like inspecting owl:hasValue restrictions
    return result;
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:35,代码来源:StructuralReasoner2.java

示例5: visit

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
public void visit(SWRLObjectPropertyAtom atom) {
    if (!(atom.getFirstArgument() instanceof SWRLIndividualArgument) || !(atom.getSecondArgument() instanceof SWRLIndividualArgument))
        throwVarError(atom);
    OWLObjectPropertyExpression ope=atom.getPredicate().getSimplified();
    OWLIndividual first=((SWRLIndividualArgument)atom.getFirstArgument()).getIndividual();
    OWLIndividual second=((SWRLIndividualArgument)atom.getSecondArgument()).getIndividual();
    if (first.isAnonymous() || second.isAnonymous())
        throwAnonIndError(atom);
    if (ope.isAnonymous())
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.getNamedProperty(),second.asOWLNamedIndividual(),first.asOWLNamedIndividual()));
    else
        addFact(m_factory.getOWLObjectPropertyAssertionAxiom(ope.asOWLObjectProperty(),first.asOWLNamedIndividual(),second.asOWLNamedIndividual()));
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:14,代码来源:OWLNormalization.java

示例6: renderObject

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
private JsonOwlObject renderObject(OWLObjectPropertyExpression p) {
	if (p.isAnonymous()) {
		return null;
	}
	return renderObject(p.asOWLObjectProperty());
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:7,代码来源:MolecularModelJsonRenderer.java

示例7: expand

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
/**
 * Create the GCIs for BioChEBI. Add the axioms into the given ontology.
 * 
 * @param ontology
 * @param ignoredClasses
 */
public void expand(OWLOntology ontology, Set<OWLClass> ignoredClasses) {
	final OWLOntologyManager manager = ontology.getOWLOntologyManager();
	final OWLDataFactory factory = manager.getOWLDataFactory();
	
	// scan axioms
	Set<OWLSubClassOfAxiom> axioms = ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED);
	for (OWLSubClassOfAxiom axiom : axioms) {
		OWLClassExpression superCE = axiom.getSuperClass();
		OWLClassExpression subCE = axiom.getSubClass();
		if (subCE.isAnonymous()) {
			// sub class needs to be an named OWLClass
			continue;
		}

		if (superCE instanceof OWLObjectSomeValuesFrom == false) {
			continue;
		}
		OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) superCE;

		OWLObjectPropertyExpression expression = some.getProperty();
		if (expression.isAnonymous()) {
			// object property expression needs to be a named OWLObjectProperty 
			continue;
		}

		OWLObjectProperty p = (OWLObjectProperty) expression;
		
		Set<OWLObjectProperty> expansions = expansionMap.get(p);
		if (expansions == null) {
			continue;
		}

		// get content for GCI
		OWLClassExpression y = some.getFiller();
		OWLClass x = subCE.asOWLClass();
		if (ignoredClasses.contains(x)) {
			continue;
		}
		for (OWLObjectProperty createProperty : expansions) {
			OWLClassExpression ce1 = factory.getOWLObjectSomeValuesFrom(createProperty, x);
			OWLClassExpression ce2 = factory.getOWLObjectSomeValuesFrom(createProperty, y);
			OWLEquivalentClassesAxiom eq = factory.getOWLEquivalentClassesAxiom(ce1, ce2);
			manager.addAxiom(ontology, eq);
		}
	}
	
	Set<OWLOntology> imports = ontology.getImports();
	StringBuilder sb = new StringBuilder();
	DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	sb.append("Generated on ").append(dateFormat.format(new Date())).append(" using the following import chain:");
	for (OWLOntology owlOntology : imports) {
		OWLOntologyID ontologyID = owlOntology.getOntologyID();
		sb.append(" ");
		appendOntologyId(ontologyID, sb);
	}
	addComment(sb.toString(), ontology);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:64,代码来源:BioChebiGenerator.java

示例8: getLabel

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
private String getLabel(OWLClassExpression expression, OWLPrettyPrinter owlpp, OWLGraphWrapper graph) {
	if (expression instanceof OWLClass) {
		return graph.getLabelOrDisplayId(expression);
	}
	else if (expression instanceof OWLObjectIntersectionOf) {
		StringBuilder sb = new StringBuilder();
		OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) expression;
		sb.append("<TABLE>");
		for (OWLClassExpression ce : intersectionOf.getOperands()) {
			sb.append("<TR><TD>");
			if (ce instanceof OWLClass) {
				sb.append(graph.getLabelOrDisplayId((OWLClass)ce));
			}
			else if (ce instanceof OWLObjectSomeValuesFrom){
				OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = some.getProperty();
				if (property.isAnonymous()) {
					sb.append(owlpp.render(property));
				}
				else {
					sb.append(graph.getLabelOrDisplayId(property.asOWLObjectProperty()));
				}
				sb.append(" <B>some</B> ");
				OWLClassExpression filler = some.getFiller();
				if (filler instanceof OWLClass) {
					sb.append(graph.getLabelOrDisplayId((OWLClass)filler));
				}
				else {
					sb.append(owlpp.render(filler));
				}
			}
			else {
				sb.append(ce.toString());
			}
			sb.append("</TD></TR>");
		}
		sb.append("</TABLE>");
		return sb.toString();
	}
	return owlpp.render(expression);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:LegoShuntGraphTool.java

示例9: getLabel

import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; //导入方法依赖的package包/类
private CharSequence getLabel(OWLClassExpression expression, OWLPrettyPrinter owlpp) {
	if (expression instanceof OWLClass) {
		return insertLineBrakes(graph.getLabelOrDisplayId(expression));
	}
	else if (expression instanceof OWLObjectIntersectionOf) {
		StringBuilder sb = new StringBuilder();
		OWLObjectIntersectionOf intersectionOf = (OWLObjectIntersectionOf) expression;
		sb.append("<TABLE>");
		for (OWLClassExpression ce : intersectionOf.getOperands()) {
			sb.append("<TR><TD>");
			if (ce instanceof OWLClass) {
				sb.append(insertLineBrakes(graph.getLabelOrDisplayId((OWLClass)ce)));
			}
			else if (ce instanceof OWLObjectSomeValuesFrom){
				OWLObjectSomeValuesFrom some = (OWLObjectSomeValuesFrom) ce;
				OWLObjectPropertyExpression property = some.getProperty();
				if (property.isAnonymous()) {
					sb.append(owlpp.render(property));
				}
				else {
					sb.append(insertLineBrakes(graph.getLabelOrDisplayId(property.asOWLObjectProperty())));
				}
				sb.append(" <B>some</B> ");
				OWLClassExpression filler = some.getFiller();
				if (filler instanceof OWLClass) {
					sb.append(insertLineBrakes(graph.getLabelOrDisplayId((OWLClass)filler)));
				}
				else {
					sb.append(insertLineBrakes(escape(owlpp.render(filler))));
				}
			}
			else {
				sb.append(insertLineBrakes(escape(ce.toString())));
			}
			sb.append("</TD></TR>");
		}
		sb.append("</TABLE>");
		return sb.toString();
	}
	return insertLineBrakes(escape(owlpp.render(expression)));
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:LegoDotWriter.java


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