Java 类org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom 实例源码

项目:minerva    文件:LegoModelWalker.java   
private Set<OWLObjectSomeValuesFrom> getExpressions(OWLNamedIndividual i, OWLOntology model) {
    Set<OWLObjectSomeValuesFrom> result = new HashSet<OWLObjectSomeValuesFrom>();
    Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(i);
    for (OWLObjectPropertyAssertionAxiom ax : axioms) {
        if (enabledBy.equals(ax.getProperty())) {
            continue;
        }
        OWLIndividual object = ax.getObject();
        if (object.isNamed()) {
            Set<OWLClass> types = getTypes(object.asOWLNamedIndividual(), model);
            for (OWLClass cls : types) {
                result.add(createSvf(ax.getProperty(), cls));
            }
        }
    }
    return result;
}
项目:minerva    文件:M3ExpressionParserTest.java   
@Test
public void testParseClazzNegatedExpression() throws Exception {

    JsonOwlObject svf = new JsonOwlObject();     
    svf.type = JsonOwlObjectType.SomeValueFrom;
    svf.property = new JsonOwlObject();
    svf.property.type = JsonOwlObjectType.ObjectProperty;
    svf.property.id = OCCURS_IN; // occurs_in
    svf.filler = new JsonOwlObject();
    svf.filler.id = NUCLEUS;
    svf.filler.type = JsonOwlObjectType.Class;

    JsonOwlObject expression = new JsonOwlObject();
    expression.type = JsonOwlObjectType.ComplementOf;
    expression.filler = svf;

    OWLDataFactory df = graph.getDataFactory();
    OWLClassExpression ce = new M3ExpressionParser(curieHandler).parse(graph, expression, null);

    OWLClass nucleus = graph.getOWLClassByIdentifier(NUCLEUS);
    OWLObjectSomeValuesFrom svfx = df.getOWLObjectSomeValuesFrom(graph.getOWLObjectPropertyByIdentifier(OCCURS_IN), nucleus);
    OWLObjectComplementOf ceExpected = df.getOWLObjectComplementOf(svfx);
    assertEquals(ceExpected, ce);
}
项目:HermiT-android    文件:OWLClausification.java   
public void visit(OWLObjectSomeValuesFrom object) {
    OWLClassExpression filler=object.getFiller();
    if (filler instanceof OWLObjectOneOf) {
        for (OWLIndividual individual : ((OWLObjectOneOf)filler).getIndividuals()) {
            Variable z=nextZ();
            m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),z));
            m_headAtoms.add(getRoleAtom(object.getProperty(),X,z));
        }
    }
    else {
        LiteralConcept toConcept=getLiteralConcept(filler);
        Role onRole=getRole(object.getProperty());
        AtLeastConcept atLeastConcept=AtLeastConcept.create(1,onRole,toConcept);
        if (!atLeastConcept.isAlwaysFalse())
            m_headAtoms.add(Atom.create(atLeastConcept,X));
    }
}
项目:Hermit_1.3.8_android    文件:OWLClausification.java   
public void visit(OWLObjectSomeValuesFrom object) {
    OWLClassExpression filler=object.getFiller();
    if (filler instanceof OWLObjectOneOf) {
        for (OWLIndividual individual : ((OWLObjectOneOf)filler).getIndividuals()) {
            Variable z=nextZ();
            m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),z));
            m_headAtoms.add(getRoleAtom(object.getProperty(),X,z));
        }
    }
    else {
        LiteralConcept toConcept=getLiteralConcept(filler);
        Role onRole=getRole(object.getProperty());
        AtLeastConcept atLeastConcept=AtLeastConcept.create(1,onRole,toConcept);
        if (!atLeastConcept.isAlwaysFalse())
            m_headAtoms.add(Atom.create(atLeastConcept,X));
    }
}
项目:owltools    文件:OldSimpleOwlSim.java   
private OWLClass expressionToClass(OWLClassExpression x) {
    if (x instanceof OWLClass)
        return (OWLClass)x;
    if (this.expressionToClassMap.containsKey(x))
        return this.expressionToClassMap.get(x);
    OWLClass c = owlDataFactory.getOWLClass(IRI.create("http://owlsim.org#"+idNum));
    idNum++;

    OWLEquivalentClassesAxiom eca =
        owlDataFactory.getOWLEquivalentClassesAxiom(c, x);
    owlOntologyManager.addAxiom(sourceOntology, eca);
    expressionToClassMap.put(x, c);

    // fully fold tbox (AND and SOME only)
    if (x instanceof OWLObjectIntersectionOf) {
        for (OWLClassExpression y : ((OWLObjectIntersectionOf)x).getOperands()) {
            expressionToClass(y);
        }
    }
    else if (x instanceof OWLObjectSomeValuesFrom) {
        expressionToClass(((OWLObjectSomeValuesFrom)x).getFiller());
    }
    return c;
}
项目:owltools    文件:AutomaticSimPreProcessor.java   
private void gatherProperties(OWLClassExpression x) {
    if (x instanceof OWLClass) {
        return;
    }
    else if (x instanceof OWLObjectIntersectionOf) {
        for (OWLClassExpression y : ((OWLObjectIntersectionOf)x).getOperands()) {
            gatherProperties(y);
        }       
    }
    else if (x instanceof OWLObjectSomeValuesFrom) {
        OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)x;
        gatherProperties(svf.getProperty());
        gatherProperties(svf.getFiller());
    }
    else {
        //
    }
}
项目:owltools    文件:PhenoSimHQEPreProcessor.java   
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);
}
项目:owltools    文件:OWLInAboxTranslator.java   
/**
 * @param i - source
 * @param supc - target expression (e.g. R some B)
 * @return OWLObjectPropertyAssertionAxiom or null
 */
private OWLObjectPropertyAssertionAxiom trEdge(OWLIndividual i, OWLClassExpression supc) {
    if (supc instanceof OWLObjectSomeValuesFrom) {
        OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom)supc;
        OWLObjectPropertyExpression p = trTypeLevel(svf.getProperty());
        OWLIndividual j;
        if (svf.getFiller().isAnonymous()) {
            j = anonClassToIndividual(svf.getFiller());
            add(trEdge(j, svf.getFiller()));
        }
        else {
            j = classToIndividual((OWLClass)svf.getFiller());
        }

        OWLObjectPropertyAssertionAxiom e = getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(p, i, j); 
        return e;
    }
    return null;

}
项目:owltools    文件:FrameMaker.java   
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);
    }
}
项目:owltools    文件:OWLGraphWrapperEdgesAdvanced.java   
Set<OWLClass> getSvfClasses(OWLClass c, OWLObjectProperty p) {
    Set<OWLSubClassOfAxiom> axioms = new HashSet<OWLSubClassOfAxiom>();
    for(OWLOntology ont : getAllOntologies()) {
        axioms.addAll(ont.getSubClassAxiomsForSubClass(c));
    }
    Set<OWLClass> superClasses = new HashSet<OWLClass>();
    for (OWLSubClassOfAxiom axiom : axioms) {
        OWLClassExpression expr = axiom.getSuperClass();
        if (expr instanceof OWLObjectSomeValuesFrom) {
            OWLObjectSomeValuesFrom svf = (OWLObjectSomeValuesFrom) expr;
            if (p.equals(svf.getProperty())) {
                OWLClassExpression filler = svf.getFiller();
                if (filler instanceof OWLClass) {
                    superClasses.add((OWLClass) filler);
                }
            }
        }
    }
    return superClasses;
}
项目:owltools    文件:CardinalityContraintsTools.java   
@Override
public HandlerResult visit(OWLObjectMinCardinality ce) {
    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);
}
项目:owltools    文件:CardinalityContraintsTools.java   
@Override
public HandlerResult visit(OWLObjectExactCardinality 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);
}
项目:owltools    文件:CardinalityContraintsTools.java   
@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);
}
项目:owltools    文件:LegoShuntGraphTool.java   
private void renderAdditionalNodeExpression(StringBuilder line, OWLClassExpression expression, OWLPrettyPrinter owlpp, OWLGraphWrapper graph) {
    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, graph));
        line.append("</TD><TD>");
        line.append(getLabel(filler, owlpp, graph));
        line.append("</TD></TR>");
    }
    else {
        line.append("<TR><TD COLSPAN=\"2\">");
        line.append(getLabel(expression, owlpp, graph));
        line.append("</TD></TR>");
    }
}
项目:owltools    文件:LegoDotWriter.java   
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>");
    }
}
项目:owltools    文件:DanglingReferenceCheck.java   
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()));
        }
    }
}
项目:owltools    文件:AssertInferredClassExpressions.java   
private static Set<OWLObjectSomeValuesFrom> filterSVFs(final OWLClassFilter clsFilter, Set<OWLObjectSomeValuesFrom> svfs) {
    Predicate<OWLObjectSomeValuesFrom> predicate = new Predicate<OWLObjectSomeValuesFrom>() {

        @Override
        public boolean apply(OWLObjectSomeValuesFrom input) {
            OWLClassExpression filler = input.getFiller();
            Boolean result = filler.accept(new OWLClassExpressionVisitorExAdapter<Boolean>(Boolean.FALSE){
                @Override
                public Boolean visit(OWLClass cls) {
                    return clsFilter.use(cls);
                }
            });
            if (result != null) {
                return result.booleanValue();
            }
            return false;
        }
    };
    svfs = Sets.filter(svfs, predicate);
    return svfs;
}
项目:OntoBench    文件:OwlObjectSomeValuesFromOwl2RlFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectSomeValuesFromProperty_RL");
  OWLClass range = featurePool.getExclusiveClass(":ObjectSomeValuesFromRange_RL");

  OWLClass someValuesFrom = featurePool.getExclusiveClass(":ObjectSomeValuesFrom_RL");
  OWLObjectSomeValuesFrom restriction = factory.getOWLObjectSomeValuesFrom(property, range);
  addAxiomToOntology(factory.getOWLSubClassOfAxiom(restriction, someValuesFrom));
}
项目:OntoBench    文件:OwlObjectSomeValuesFromFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":objectSomeValuesFromProperty");
  OWLClass range = featurePool.getExclusiveClass(":ObjectSomeValuesFromRange");

  OWLClass someValuesFrom = featurePool.getExclusiveClass(":ObjectSomeValuesFrom");
  OWLObjectSomeValuesFrom restriction = factory.getOWLObjectSomeValuesFrom(property, range);
  addAxiomToOntology(factory.getOWLSubClassOfAxiom(someValuesFrom, restriction));
}
项目:uel    文件:UelOntology.java   
private Set<Integer> flattenClassExpression(OWLClassExpression expression, Set<Definition> newDefinitions,
        Set<Integer> newNames) {
    if (expression instanceof OWLClass) {
        return flattenClass((OWLClass) expression, newNames);
    }
    if (expression instanceof OWLObjectIntersectionOf) {
        return flattenConjunction((OWLObjectIntersectionOf) expression, newDefinitions, newNames);
    }
    if (expression instanceof OWLObjectSomeValuesFrom) {
        return flattenExistentialRestriction((OWLObjectSomeValuesFrom) expression, newDefinitions, newNames);
    }
    throw new RuntimeException("Unsupported class expression: " + expression);
}
项目:uel    文件:UelOntology.java   
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);
}
项目:minerva    文件:LegoToGeneAnnotationTranslator.java   
@Override
protected boolean handleCC(Summary payload, OWLClass cls,
        Metadata metadata, Set<Evidence> evidences,
        Set<OWLObjectSomeValuesFrom> expressions) {
    boolean added = false;
    if (isCc(cls)) {
        added = payload.addCc(cls, metadata, evidences, expressions);
    }
    return added;
}
项目:minerva    文件:LegoToGeneAnnotationTranslator.java   
@Override
protected boolean handleMF(Summary payload, OWLClass cls,
        Metadata metadata, Set<Evidence> evidences,
        Set<OWLObjectSomeValuesFrom> expressions) {
    if (isMf(cls)) {
        payload.addMf(cls, metadata, evidences, expressions);
    }
    return true;
}
项目:minerva    文件:LegoToGeneAnnotationTranslator.java   
@Override
protected boolean handleBP(Summary payload, OWLClass cls,
        Metadata metadata, Set<Evidence> evidences,
        Set<OWLObjectSomeValuesFrom> expressions) {
    boolean added = false;
    if (isBp(cls)) {
        added = payload.addBp(cls, metadata, evidences, expressions);
    }
    return added;
}
项目:minerva    文件:LegoModelWalker.java   
private Set<OWLObjectSomeValuesFrom> getSvfTypes(OWLNamedIndividual i, OWLOntology model) {
    Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(i);
    final Set<OWLObjectSomeValuesFrom> svfs = new HashSet<OWLObjectSomeValuesFrom>();
    for (OWLClassAssertionAxiom axiom : axioms) {
        axiom.getClassExpression().accept(new OWLClassExpressionVisitorAdapter(){

            @Override
            public void visit(OWLObjectSomeValuesFrom svf) {
                svfs.add(svf);
            }
        });
    }
    return svfs;
}
项目:Wolpertinger    文件:NaiveTranslation.java   
/**
 * According to the naive translation:<br/>
 * <br/>
 * <code>naive(Exists r.A) := not r(X,Y), A(Y)</code>
 *
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom)
 */

public void visit(OWLObjectSomeValuesFrom objExistential) {
    // we require normalized axioms, therefore we can do the following
    OWLObjectPropertyExpression property = objExistential.getProperty();
    OWLClassExpression fillerClass = objExistential.getFiller();

    OWLObjectMinCardinality minCard = new OWLObjectMinCardinalityImpl(property, 1, fillerClass);
    visit(minCard);
}
项目:minerva    文件:AbstractLegoTranslator.java   
boolean addMf(OWLClass cls, Metadata metadata, Set<Evidence> evidences, Set<OWLObjectSomeValuesFrom> expressions) {
    if (isMf(cls)) {
        activities = addAnnotation(cls, metadata, evidences, expressions, activities);
        return true;
    }
    return false;
}
项目:minerva    文件:AbstractLegoTranslator.java   
boolean addBp(OWLClass cls, Metadata metadata, Set<Evidence> evidences, Set<OWLObjectSomeValuesFrom> expressions) {
    if (isBp(cls)) {
        processes = addAnnotation(cls, metadata, evidences, expressions, processes);
        return true;
    }
    return false;
}
项目:minerva    文件:AbstractLegoTranslator.java   
boolean addCc(OWLClass cls, Metadata metadata, Set<Evidence> evidences, Set<OWLObjectSomeValuesFrom> expressions) {
    if (isCc(cls)) {
        locations = addAnnotation(cls, metadata, evidences, expressions, locations);
        return true;
    }
    return false;
}
项目:minerva    文件:AbstractLegoTranslator.java   
private <T> Set<Entry<T>> addAnnotation(T cls, Metadata metadata, Set<Evidence> evidences, Set<OWLObjectSomeValuesFrom> expressions, Set<Entry<T>> set) {
    if (set == null) {
        set = new HashSet<Entry<T>>();
    }
    Entry<T> entry = new Entry<T>();
    entry.value = cls;
    entry.metadata = metadata;
    entry.evidences = new ArrayList<>(evidences);
    if (expressions != null) {
        entry.expressions = expressions;
    }
    set.add(entry);
    return set;
}
项目:minerva    文件:AbstractLegoTranslator.java   
protected List<GeneAnnotation> createAnnotations(Entry<OWLClass> entry, Bioentity entity, String aspect,
        List<String> additionalReferences,
        OWLGraphWrapper g, Collection<OWLObjectSomeValuesFrom> c16) {
    List<GeneAnnotation> result = new ArrayList<>();
    if (entry.evidences != null) {
        for(Evidence evidence : entry.evidences) {
            GeneAnnotation ann = createAnnotation(entry.value, entry.metadata, evidence, entity, aspect, additionalReferences, g, c16);
            result.add(ann);
        }
    }
    return result;
}
项目:minerva    文件:CoreMolecularModelManager.java   
/**
 * Adds a ClassAssertion, where the class expression instantiated is an
 * ObjectSomeValuesFrom expression
 * 
 * Example: Individual: i Type: enabledBy some PRO_123
 *  
 * @param model
 * @param i
 * @param p
 * @param filler
 * @param metadata
 */
void addType(ModelContainer model,
        OWLIndividual i, 
        OWLObjectPropertyExpression p,
        OWLClassExpression filler,
        METADATA metadata) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Adding "+i+ " type "+p+" some "+filler); 
    }
    OWLDataFactory f = model.getOWLDataFactory();
    OWLObjectSomeValuesFrom c = f.getOWLObjectSomeValuesFrom(p, filler);
    OWLClassAssertionAxiom axiom = f.getOWLClassAssertionAxiom(c, i);
    addAxiom(model, axiom, metadata);
}
项目:UMLS-Terminology-Server    文件:OwlLoaderAlgorithm.java   
/**
 * Load owl class.
 *
 * @param expr the owl class
 * @param ontology the ontology
 * @param level the level
 * @return the concept
 * @throws Exception the exception
 */
private Concept getConceptForOwlClassExpression(OWLClassExpression expr,
  OWLOntology ontology, int level) throws Exception {

  // Log it
  if (expr instanceof OWLClass) {
    OwlUtility.logOwlClass((OWLClass) expr, ontology, level);
  } else {
    OwlUtility.logOwlClassExpression(expr, ontology, level);
  }

  // Handle direct OWLClass
  if (expr instanceof OWLClass) {
    return getConceptForOwlClass((OWLClass) expr, ontology, level);
  }

  // Handle ObjectIntersectionOf
  else if (expr instanceof OWLObjectIntersectionOf) {
    return getConceptForIntersectionOf((OWLObjectIntersectionOf) expr,
        ontology, level);
  }

  // Handle ObjectUnionOf
  else if (expr instanceof OWLObjectUnionOf) {
    return getConceptForUnionOf((OWLObjectUnionOf) expr, ontology, level);
  }

  // Handle ObjectSomeValuesFrom
  else if (expr instanceof OWLObjectSomeValuesFrom) {
    return getConceptForSomeValuesFrom((OWLObjectSomeValuesFrom) expr,
        ontology, level);

  }

  else {
    throw new Exception("Unexpected class expression type - "
        + expr.getClassExpressionType());
  }

}
项目:jopa    文件:IntegrityConstraintClassParser.java   
public void visit(OWLObjectSomeValuesFrom arg0) {
    try {
        OWLClass c = Utils.ensureClass(arg0.getFiller());
        OWLObjectProperty p = Utils.ensureObjectProperty(arg0.getProperty());

        integrityConstraints.add(integrityConstraintFactory
            .MinObjectParticipationConstraint(subjClass, p, c, 1));
    } catch (UnsupportedICException e) {
        notSupported(arg0);
    }
}
项目:HermiT-android    文件:BuiltInPropertyManager.java   
protected void axiomatizeTopObjectProperty(OWLAxioms axioms) {
    // TransitiveObjectProperty( owl:topObjectProperty )
    axioms.m_complexObjectPropertyInclusions.add(new OWLAxioms.ComplexObjectPropertyInclusion(m_topObjectProperty));
    // SymmetricObjectProperty( owl:topObjectProperty )
    axioms.m_simpleObjectPropertyInclusions.add(new OWLObjectPropertyExpression[] { m_topObjectProperty,m_topObjectProperty.getInverseProperty() });
    // SubClassOf( owl:Thing ObjectSomeValuesFrom( owl:topObjectProperty ObjectOneOf( <internal:nam#topIndividual> ) ) )
    OWLIndividual newIndividual=m_factory.getOWLNamedIndividual(IRI.create("internal:nam#topIndividual"));
    OWLObjectOneOf oneOfNewIndividual=m_factory.getOWLObjectOneOf(newIndividual);
    OWLObjectSomeValuesFrom hasTopNewIndividual=m_factory.getOWLObjectSomeValuesFrom(m_topObjectProperty,oneOfNewIndividual);
    axioms.m_conceptInclusions.add(new OWLClassExpression[] { hasTopNewIndividual });
}
项目:HermiT-android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectSomeValuesFrom object) {
    m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
    OWLClassExpression filler=object.getFiller();
    if (isSimple(filler) || isNominal(filler))
        // The ObjectOneof cases is an optimization.
        return object;
    else {
        OWLClassExpression definition=getDefinitionFor(filler,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),filler });
        return m_factory.getOWLObjectSomeValuesFrom(object.getProperty(),definition);
    }
}
项目:HermiT-android    文件:ExpressionManager.java   
public OWLClassExpression visit(OWLObjectSomeValuesFrom d) {
    OWLClassExpression filler=getSimplified(d.getFiller());
    if (filler.isOWLNothing())
        return m_factory.getOWLNothing();
    else
        return m_factory.getOWLObjectSomeValuesFrom(d.getProperty().getSimplified(),filler);
}
项目:Hermit_1.3.8_android    文件:BuiltInPropertyManager.java   
protected void axiomatizeTopObjectProperty(OWLAxioms axioms) {
    // TransitiveObjectProperty( owl:topObjectProperty )
    axioms.m_complexObjectPropertyInclusions.add(new OWLAxioms.ComplexObjectPropertyInclusion(m_topObjectProperty));
    // SymmetricObjectProperty( owl:topObjectProperty )
    axioms.m_simpleObjectPropertyInclusions.add(new OWLObjectPropertyExpression[] { m_topObjectProperty,m_topObjectProperty.getInverseProperty() });
    // SubClassOf( owl:Thing ObjectSomeValuesFrom( owl:topObjectProperty ObjectOneOf( <internal:nam#topIndividual> ) ) )
    OWLIndividual newIndividual=m_factory.getOWLNamedIndividual(IRI.create("internal:nam#topIndividual"));
    OWLObjectOneOf oneOfNewIndividual=m_factory.getOWLObjectOneOf(newIndividual);
    OWLObjectSomeValuesFrom hasTopNewIndividual=m_factory.getOWLObjectSomeValuesFrom(m_topObjectProperty,oneOfNewIndividual);
    axioms.m_conceptInclusions.add(new OWLClassExpression[] { hasTopNewIndividual });
}
项目:jcel    文件:ClassExpressionTranslator.java   
@Override
public IntegerClassExpression visit(OWLObjectSomeValuesFrom ce) {
    Objects.requireNonNull(ce);
    IntegerObjectPropertyExpression propertyExpr = ce.getProperty().accept(getObjectPropertyExpressionTranslator());
    OWLClassExpression desc = ce.getFiller();
    IntegerClassExpression classExpression = desc.accept(this);
    return getDataTypeFactory().createObjectSomeValuesFrom(propertyExpr, classExpression);
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectSomeValuesFrom object) {
    m_axioms.m_objectPropertiesOccurringInOWLAxioms.add(object.getProperty().getNamedProperty());
    OWLClassExpression filler=object.getFiller();
    if (isSimple(filler) || isNominal(filler))
        // The ObjectOneof cases is an optimization.
        return object;
    else {
        OWLClassExpression definition=getDefinitionFor(filler,m_alreadyExists);
        if (!m_alreadyExists[0])
            m_newInclusions.add(new OWLClassExpression[] { negative(definition),filler });
        return m_factory.getOWLObjectSomeValuesFrom(object.getProperty(),definition);
    }
}