本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectUnionOf.getOperands方法的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectUnionOf.getOperands方法的具体用法?Java OWLObjectUnionOf.getOperands怎么用?Java OWLObjectUnionOf.getOperands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLObjectUnionOf
的用法示例。
在下文中一共展示了OWLObjectUnionOf.getOperands方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public HandlerResult visit(OWLObjectUnionOf unionOf) {
Set<OWLClassExpression> newOperands = new HashSet<OWLClassExpression>();
boolean changed = false;
for (OWLClassExpression ce : unionOf.getOperands()) {
HandlerResult handlerResult = ce.accept(this);
if (handlerResult != null) {
if (handlerResult.remove) {
return HandlerResult.remove();
}
changed = true;
newOperands.add(handlerResult.modified);
}
else {
newOperands.add(ce);
}
}
if (changed) {
if (newOperands.size() == 1) {
return HandlerResult.modified(newOperands.iterator().next());
}
return HandlerResult.modified(factory.getOWLObjectUnionOf(newOperands));
}
return null;
}
示例2: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
public void visit(OWLObjectUnionOf union) {
Set<OWLClassExpression> ops = union.getOperands();
for (OWLClassExpression op : ops) {
/*
* ArrayList<OWLClassExpression> l = new
* ArrayList<OWLClassExpression>(); new
* NormalizatorClassExpressionVisitor(op, l); list.addAll(l);
*/
try {
list.addAll(getListOfConjunctions(op));
} catch (UnusedClassExpressionException e) {
errorCnt++;
}
}
}
示例3: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
public OWLClassExpression visit(OWLObjectUnionOf d) {
Set<OWLClassExpression> newDisjuncts=new HashSet<OWLClassExpression>();
for (OWLClassExpression description : d.getOperands()) {
OWLClassExpression descriptionNNF=getNNF(description);
newDisjuncts.add(descriptionNNF);
}
return m_factory.getOWLObjectUnionOf(newDisjuncts);
}
示例4: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public OWLObjectUnionOf visit(OWLObjectUnionOf ce) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unfolding union_of: "+ce);
}
Set<OWLClassExpression> operands = ce.getOperands();
if (operands != null && !operands.isEmpty()) {
Set<OWLClassExpression> unfolded = unfoldExpressions(operands);
if (unfolded != null) {
return factory.getOWLObjectUnionOf(unfolded);
}
}
return null;
}
示例5: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
public void visit(OWLObjectUnionOf arg0) {
boolean isFirst=true;
for (OWLClassExpression operand : arg0.getOperands()) {
if (!isFirst)
writer.write(" or ");
operand.accept(this);
isFirst=false;
}
}
示例6: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public Void visit(OWLObjectUnionOf desc) {
long subject = getOrCreateNode(getIri(desc), OwlLabels.OWL_UNION_OF, OwlLabels.OWL_ANONYMOUS);
for (OWLClassExpression expression : desc.getOperands()) {
long object = getOrCreateNode(getIri(expression));
getOrCreateRelationship(subject, object, OwlRelationships.OPERAND);
}
return null;
}
示例7: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public OWLClassExpression visit(OWLObjectUnionOf ce) {
Set<OWLClassExpression> ops = new HashSet<>();
for (OWLClassExpression op : ce.getOperands()) {
ops.add(op.accept(this));
}
if (negated) {
// Flip to an intersection
return dataFactory.getOWLObjectIntersectionOf(ops);
} else {
return dataFactory.getOWLObjectUnionOf(ops);
}
}
示例8: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public Set<OWLClassExpression> visit(OWLObjectUnionOf ce) {
Set<OWLClassExpression> result = new HashSet<>();
result.add(ce);
for (OWLClassExpression op : ce.getOperands()) {
result.addAll(op.accept(this));
}
return result;
}
示例9: getConceptForUnionOf
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
/**
* Returns the concept for an ObjectUnionOf. This is just used to borrow
* relationships and never actually creates an anonymous concept.
*
* @param expr the expr
* @param ontology the ontology
* @param level the level
* @return the concept for union
* @throws Exception the exception
*/
private Concept getConceptForUnionOf(OWLObjectUnionOf expr,
OWLOntology ontology, int level) throws Exception {
String uuid = TerminologyUtility.getUuid(expr.toString()).toString();
if (idMap.containsKey(uuid)) {
return getConcept(idMap.get(uuid));
}
Concept concept = new ConceptJpa();
setCommonFields(concept);
concept.setWorkflowStatus(WorkflowStatus.PUBLISHED);
concept.setAnonymous(true);
concept.setTerminologyId(uuid);
concept.setName(expr.toString());
concept.setUsesRelationshipIntersection(false);
concept.setUsesRelationshipUnion(true);
// Handle nested class expressions
if (expr.getOperands().size() > 1) {
// Iterate through expressions and either add a parent relationship
// or add relationships from the concept itself. No new anonymous
// concepts are directly created here.
for (final OWLClassExpression expr2 : expr.getOperands()) {
final Concept concept2 =
getConceptForOwlClassExpression(expr2, ontology, level + 1);
// If it's a restriction, borrow its relationships
if (expr2 instanceof OWLObjectIntersectionOf) {
// make an anonymous concept out of this and a relationship to it.
// Add if anonymous and doesn't exist yet
if (concept2.isAnonymous()
&& !idMap.containsKey(concept2.getTerminologyId())) {
addAnonymousConcept(concept2);
exprMap.put(concept2.getTerminologyId(), expr);
}
ConceptRelationship rel =
getSubClassOfRelationship(concept, concept2);
rel.setRelationshipType("other");
rel.setAdditionalRelationshipType("");
concept.getRelationships().add(rel);
}
// otherwise, unknown type
else {
throw new Exception("Unexpected operand expression type - " + expr2);
}
}
return concept;
}
// ASSUMPTION: union has at least two sub-expressions
else {
throw new Exception(
"Unexpected number of union nested class expressions - " + expr);
}
}
示例10: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
public void visit(OWLObjectUnionOf object) {
for (OWLClassExpression description : object.getOperands())
description.accept(this);
}
示例11: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
public Boolean visit(OWLObjectUnionOf object) {
for (OWLClassExpression desc : object.getOperands())
if (desc.accept(this))
return Boolean.TRUE;
return Boolean.FALSE;
}
示例12: visit
import org.semanticweb.owlapi.model.OWLObjectUnionOf; //导入方法依赖的package包/类
@Override
public void visit(@Nonnull OWLObjectUnionOf ce) {
for (OWLClassExpression operand : ce.getOperands()) {
operand.accept(this);
}
}