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

项目:owltools    文件:OWLGsonParser.java   
public Object convert(OWLObject obj) {
    if (obj instanceof IRI) {
        return obj.toString();
    }
    else if (obj instanceof OWLEntity) {
        return convert(((OWLEntity)obj).getIRI());
    }
    else if (obj instanceof OWLClassExpression) {
        // {type: <Class|SomeValuesFrom|...>,  args: [...]
        Map<String,Object> m = new HashMap<String,Object>();
        m.put("type", ((OWLClassExpression) obj).getClassExpressionType().toString());
        Object[] arr;
        if (obj instanceof OWLQuantifiedObjectRestriction) {
            OWLQuantifiedObjectRestriction r = (OWLQuantifiedObjectRestriction)obj;
            arr = new Object[] {
                     convert(r.getProperty()),
                     convert(r.getFiller())
            };
            // TODO: QCRs
        }
        else if (obj instanceof OWLNaryBooleanClassExpression) {
            arr = convertSet( ((OWLNaryBooleanClassExpression)obj).getOperands());
        }
        else {
            arr = new Object[0];
            // TODO
        }
        m.put("args", arr);
        return m;
    }
    else if (obj instanceof OWLLiteral) {
        return ((OWLLiteral)obj).getLiteral();
    }
    else {
        return obj.toString(); // TODO
    }
}
项目:owlapi-gwt    文件:OWLNaryBooleanClassExpressionImpl.java   
@Override
public boolean equals(Object obj) {
    if (!(obj instanceof OWLNaryBooleanClassExpression)) {
        return false;
    }
    if (obj instanceof OWLNaryBooleanClassExpressionImpl) {
        return operands.equals(((OWLNaryBooleanClassExpressionImpl) obj).operands);
    }
    return ((OWLNaryBooleanClassExpression) obj).getOperands().equals(
        getOperands());
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public void getProperties(OWLClassExpression desc, Set<Object> list, Set<Object> visited) throws OWLException {
    if (desc instanceof OWLRestriction) {
        //getProperties( (OWLRestriction)desc, list );
        list.add(((OWLRestriction) desc).getProperty());
    } else if (desc instanceof OWLClass) {
        getProperties((OWLClass) desc, list, visited);
    } else if (desc instanceof OWLNaryBooleanClassExpression) {
        for (Object d : ((OWLNaryBooleanClassExpression) desc).getOperands()) {
            getProperties((OWLClassExpression) d, list, visited);
        }
        //getProperties( (OWLNaryBooleanClassExpression)desc, list, visited );
    }
}
项目:owlapi-gwt    文件:OWLNaryBooleanClassExpressionImpl.java   
@Override
protected int compareObjectOfSameType(OWLObject object) {
    return compareSets(operands,
        ((OWLNaryBooleanClassExpression) object).getOperands());
}
项目:align-api-project    文件:OWLAPI3Ontology.java   
public void getProperties(OWLNaryBooleanClassExpression d, Set<Object> list, Set<Object> visited) throws OWLException {
    for (OWLClassExpression desc : d.getOperands()) {
        getProperties(desc, list, visited);
    }
}
项目:pronto    文件:PTBoxImpl.java   
private void enrichSignature(   Set<ATermAppl> classSet,
                                Map<String, OWLClassExpression> nameMap,
                                boolean removeAutoGenNames,
                                KnowledgeBase kb) {

    nameMap = nameMap == null ? new HashMap<String, OWLClassExpression>() : nameMap;

    if( removeAutoGenNames ) {
        //Remove auto generated names from the signature
        for( Iterator<ATermAppl> classIter = classSet.iterator(); classIter.hasNext(); ) {

            ATermAppl clazz = classIter.next();

            if( nameMap.containsKey( clazz.toString() ) ) classIter.remove();
        }
    }
    //Add classes that appear in abbreviated expressions
    for (String name : nameMap.keySet()) {

        OWLClassExpression expr = nameMap.get( name );

        switch (expr.getClassExpressionType()) {

        case OBJECT_UNION_OF:

        case OBJECT_INTERSECTION_OF:

            OWLNaryBooleanClassExpression nary = (OWLNaryBooleanClassExpression) expr;

            for (OWLClassExpression exprPart : nary.getOperands()) {

                classSet.add( convertToATerm(exprPart, kb) );
            }

        default:

            classSet.add( convertToATerm(expr, kb) );
        }
    }
}