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

项目:HermiT-android    文件:OWLClausification.java   
public void visit(OWLObjectComplementOf object) {
    OWLClassExpression description=object.getOperand();
    if (description instanceof OWLObjectHasSelf) {
        OWLObjectPropertyExpression objectProperty=((OWLObjectHasSelf)description).getProperty();
        Atom roleAtom=getRoleAtom(objectProperty,X,X);
        m_bodyAtoms.add(roleAtom);
    }
    else if (description instanceof OWLObjectOneOf && ((OWLObjectOneOf)description).getIndividuals().size()==1) {
        OWLIndividual individual=((OWLObjectOneOf)description).getIndividuals().iterator().next();
        m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),X));
    }
    else if (!(description instanceof OWLClass))
        throw new IllegalStateException("Internal error: invalid normal form.");
    else
        m_bodyAtoms.add(Atom.create(AtomicConcept.create(((OWLClass)description).getIRI().toString()),X));
}
项目: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(OWLObjectComplementOf object) {
    OWLClassExpression description=object.getOperand();
    if (description instanceof OWLObjectHasSelf) {
        OWLObjectPropertyExpression objectProperty=((OWLObjectHasSelf)description).getProperty();
        Atom roleAtom=getRoleAtom(objectProperty,X,X);
        m_bodyAtoms.add(roleAtom);
    }
    else if (description instanceof OWLObjectOneOf && ((OWLObjectOneOf)description).getIndividuals().size()==1) {
        OWLIndividual individual=((OWLObjectOneOf)description).getIndividuals().iterator().next();
        m_bodyAtoms.add(Atom.create(getConceptForNominal(individual),X));
    }
    else if (!(description instanceof OWLClass))
        throw new IllegalStateException("Internal error: invalid normal form.");
    else
        m_bodyAtoms.add(Atom.create(AtomicConcept.create(((OWLClass)description).getIRI().toString()),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));
    }
}
项目:Wolpertinger    文件:OWLNormalization.java   
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;
         */
     }
项目:Wolpertinger    文件:DebugTranslation.java   
/**
 * 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;
}
项目:Wolpertinger    文件:NaiveTranslation.java   
/**
 * 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;
}
项目:OWL2SPARQL    文件:OWLClassExpressionMinimizer.java   
@Override
public OWLClassExpression visit(OWLObjectSomeValuesFrom ce) {
    OWLClassExpression filler = ce.getFiller();
    OWLClassExpression shortenedFiller = filler.accept(this);
    if(shortenedFiller.isOWLNothing()){// \exists r.\bottom \equiv \bottom
        return df.getOWLNothing();
    } else if(!filler.equals(shortenedFiller)){
        return df.getOWLObjectSomeValuesFrom(ce.getProperty(), shortenedFiller);
    }

    // convert r some {a} to r value a
    if(shortenedFiller instanceof OWLObjectOneOf && ((OWLObjectOneOf) shortenedFiller).getIndividuals().size() == 1) {
        return df.getOWLObjectHasValue(ce.getProperty(), ((OWLObjectOneOf) shortenedFiller).getIndividuals().iterator().next());
    }
    return ce;
}
项目:OntoBench    文件:OwlObjectOneOfFeature.java   
@Override
public void addToOntology() {
  OWLNamedIndividual i1 = factory.getOWLNamedIndividual(":ObjectOneOf_Individual1", pm);
  OWLNamedIndividual i2 = factory.getOWLNamedIndividual(":ObjectOneOf_Individual2", pm);
  OWLObjectOneOf oneOf = factory.getOWLObjectOneOf(i1, i2);

  OWLClass oneOfClass = featurePool.getExclusiveClass(":ObjectOneOf");

  addAxiomToOntology(factory.getOWLEquivalentClassesAxiom(oneOfClass, oneOf));
}
项目:OntoBench    文件:OwlObjectOneOfOwl2RlFeature.java   
@Override
public void addToOntology() {
  OWLNamedIndividual i1 = factory.getOWLNamedIndividual(":ObjectOneOf_RL_Individual1", pm);
  OWLNamedIndividual i2 = factory.getOWLNamedIndividual(":ObjectOneOf_RL_Individual2", pm);
  OWLObjectOneOf oneOf = factory.getOWLObjectOneOf(i1, i2);

  OWLClass oneOfClass = featurePool.getExclusiveClass(":ObjectOneOf_RL");

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(oneOf, oneOfClass));
}
项目:OntoBench    文件:OwlObjectOneOfOwl2ElFeature.java   
@Override
public void addToOntology() {
  OWLNamedIndividual individual = factory.getOWLNamedIndividual(":ObjectOneOf_EL_Individual", pm);
  OWLObjectOneOf oneOf = factory.getOWLObjectOneOf(individual);

  OWLClass oneOfClass = featurePool.getExclusiveClass(":ObjectOneOf_EL");

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(oneOfClass, oneOf));
}
项目: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 OWLNormalization(OWLDataFactory factory,OWLAxioms axioms,int firstReplacementIndex) {
    m_factory=factory;
    m_axioms=axioms;
    m_firstReplacementIndex=firstReplacementIndex;
    m_definitions=new HashMap<OWLClassExpression,OWLClassExpression>();
    m_definitionsForNegativeNominals=new HashMap<OWLObjectOneOf,OWLClass>();
    m_expressionManager=new ExpressionManager(m_factory);
    m_plVisitor=new PLVisitor();
    m_dataRangeDefinitions=new HashMap<OWLDataRange,OWLDatatype>();
}
项目:HermiT-android    文件:OWLNormalization.java   
protected static boolean isNegatedOneNominal(OWLClassExpression description) {
    if (!(description instanceof OWLObjectComplementOf))
        return false;
    OWLClassExpression operand=((OWLObjectComplementOf)description).getOperand();
    if (!(operand instanceof OWLObjectOneOf))
        return false;
    return ((OWLObjectOneOf)operand).getIndividuals().size()==1;
}
项目:HermiT-android    文件:OWLNormalization.java   
protected OWLClass getDefinitionForNegativeNominal(OWLObjectOneOf nominal,boolean[] alreadyExists) {
    OWLClass definition=m_definitionsForNegativeNominals.get(nominal);
    if (definition==null) {
        definition=m_factory.getOWLClass(IRI.create("internal:nnq#"+m_definitionsForNegativeNominals.size()));
        m_definitionsForNegativeNominals.put(nominal,definition);
        alreadyExists[0]=false;
    }
    else
        alreadyExists[0]=true;
    return definition;
}
项目:HermiT-android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectComplementOf object) {
    if (isNominal(object.getOperand())) {
        OWLObjectOneOf objectOneOf=(OWLObjectOneOf)object.getOperand();
        OWLClass definition=getDefinitionForNegativeNominal(objectOneOf,m_alreadyExists);
        if (!m_alreadyExists[0])
            for (OWLIndividual individual : objectOneOf.getIndividuals())
                addFact(m_factory.getOWLClassAssertionAxiom(definition,individual));
        return m_factory.getOWLObjectComplementOf(definition);
    }
    else
        return object;
}
项目:HermiT-android    文件:OWLClausification.java   
public void visit(OWLObjectOneOf object) {
    for (OWLIndividual individual : object.getIndividuals()) {
        Variable z=nextZ();
        AtomicConcept conceptForNominal=getConceptForNominal(individual);
        m_headAtoms.add(Atom.create(Equality.INSTANCE,X,z));
        m_bodyAtoms.add(Atom.create(conceptForNominal,z));
    }
}
项目: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 });
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public OWLNormalization(OWLDataFactory factory,OWLAxioms axioms,int firstReplacementIndex) {
    m_factory=factory;
    m_axioms=axioms;
    m_firstReplacementIndex=firstReplacementIndex;
    m_definitions=new HashMap<OWLClassExpression,OWLClassExpression>();
    m_definitionsForNegativeNominals=new HashMap<OWLObjectOneOf,OWLClass>();
    m_expressionManager=new ExpressionManager(m_factory);
    m_plVisitor=new PLVisitor();
    m_dataRangeDefinitions=new HashMap<OWLDataRange,OWLDatatype>();
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
protected static boolean isNegatedOneNominal(OWLClassExpression description) {
    if (!(description instanceof OWLObjectComplementOf))
        return false;
    OWLClassExpression operand=((OWLObjectComplementOf)description).getOperand();
    if (!(operand instanceof OWLObjectOneOf))
        return false;
    return ((OWLObjectOneOf)operand).getIndividuals().size()==1;
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
protected OWLClass getDefinitionForNegativeNominal(OWLObjectOneOf nominal,boolean[] alreadyExists) {
    OWLClass definition=m_definitionsForNegativeNominals.get(nominal);
    if (definition==null) {
        definition=m_factory.getOWLClass(IRI.create("internal:nnq#"+m_definitionsForNegativeNominals.size()));
        m_definitionsForNegativeNominals.put(nominal,definition);
        alreadyExists[0]=false;
    }
    else
        alreadyExists[0]=true;
    return definition;
}
项目:Hermit_1.3.8_android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectComplementOf object) {
    if (isNominal(object.getOperand())) {
        OWLObjectOneOf objectOneOf=(OWLObjectOneOf)object.getOperand();
        OWLClass definition=getDefinitionForNegativeNominal(objectOneOf,m_alreadyExists);
        if (!m_alreadyExists[0])
            for (OWLIndividual individual : objectOneOf.getIndividuals())
                addFact(m_factory.getOWLClassAssertionAxiom(definition,individual));
        return m_factory.getOWLObjectComplementOf(definition);
    }
    else
        return object;
}
项目:Hermit_1.3.8_android    文件:OWLClausification.java   
public void visit(OWLObjectOneOf object) {
    for (OWLIndividual individual : object.getIndividuals()) {
        Variable z=nextZ();
        AtomicConcept conceptForNominal=getConceptForNominal(individual);
        m_headAtoms.add(Atom.create(Equality.INSTANCE,X,z));
        m_bodyAtoms.add(Atom.create(conceptForNominal,z));
    }
}
项目:Wolpertinger    文件:OWLNormalization.java   
public OWLNormalization(OWLDataFactory factory,OWLAxioms axioms,int firstReplacementIndex) {
    m_factory=factory;
    m_axioms=axioms;
    m_firstReplacementIndex=firstReplacementIndex;
    m_definitions=new HashMap<OWLClassExpression,OWLClassExpression>();
    m_definitionsForNegativeNominals=new HashMap<OWLObjectOneOf,OWLClass>();
    m_expressionManager=new ExpressionManager(m_factory);
    m_plVisitor=new PLVisitor();
    m_dataRangeDefinitions=new HashMap<OWLDataRange,OWLDatatype>();
    m_domain = new HashSet<OWLNamedIndividual>();
}
项目:Wolpertinger    文件:OWLNormalization.java   
protected static boolean isNegatedOneNominal(OWLClassExpression description) {
    if (!(description instanceof OWLObjectComplementOf))
        return false;
    OWLClassExpression operand=((OWLObjectComplementOf)description).getOperand();
    if (!(operand instanceof OWLObjectOneOf))
        return false;
    return ((OWLObjectOneOf)operand).getIndividuals().size()==1;
}
项目:Wolpertinger    文件:OWLNormalization.java   
protected OWLClass getDefinitionForNegativeNominal(OWLObjectOneOf nominal,boolean[] alreadyExists) {
    OWLClass definition=m_definitionsForNegativeNominals.get(nominal);
    if (definition==null) {
        definition=m_factory.getOWLClass(IRI.create("internal:nnq#"+m_definitionsForNegativeNominals.size()));
        m_definitionsForNegativeNominals.put(nominal,definition);
        alreadyExists[0]=false;
    }
    else
        alreadyExists[0]=true;
    return definition;
}
项目:Wolpertinger    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectComplementOf object) {
    if (isNominal(object.getOperand())) {
        OWLObjectOneOf objectOneOf=(OWLObjectOneOf)object.getOperand();
        OWLClass definition=getDefinitionForNegativeNominal(objectOneOf,m_alreadyExists);
        if (!m_alreadyExists[0]) {
            for (OWLIndividual individual : objectOneOf.getIndividuals()) {
                addFact(m_factory.getOWLClassAssertionAxiom(definition,individual));
            }
        }
        return m_factory.getOWLObjectComplementOf(definition);
    }
    else
        return object;
}
项目:Wolpertinger    文件:DebugTranslation.java   
/**
 * We assume that we deal with a normalized axioms, i.e. they are in NNF and structural transformation took place.
 *
 * Thereofre we test here whether the operand
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectComplementOf)
 */

public void visit(OWLObjectComplementOf objComplementOf) {
    OWLClassExpression operand = objComplementOf.getOperand();
    if (operand instanceof OWLClass) {
        OWLClass owlClass = operand.asOWLClass();
        String predicateName = mapper.getPredicateName(owlClass);

        writer.print(predicateName);
        writer.print(ASP2CoreSymbols.BRACKET_OPEN);
        writer.print(var.currentVar());
        writer.print(ASP2CoreSymbols.BRACKET_CLOSE);

        if (isAuxiliaryClass(owlClass)) auxClasses.add(owlClass);
    }
    //
    else if (operand instanceof OWLObjectHasSelf) {
        OWLObjectHasSelf owlHasSelf = (OWLObjectHasSelf) operand;
        OWLObjectProperty property = owlHasSelf.getProperty().asOWLObjectProperty();
        String propertyName = mapper.getPredicateName(property);
        String cVar = var.currentVar();

        // r(X,X)
        writer.print(propertyName);
        writer.print(ASP2CoreSymbols.BRACKET_OPEN);
        writer.print(cVar);
        writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
        writer.print(cVar);
        writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
    }
    else if (operand instanceof OWLObjectOneOf) {
        throw new NotImplementedException();
    }
}
项目:Wolpertinger    文件:DebugTranslation.java   
/**
 *
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectOneOf)
 */

public void visit(OWLObjectOneOf owlOneOf) {
    boolean isFirst=true;
    for (OWLIndividual individual : owlOneOf.getIndividuals()) {
        if (individual.isNamed()){
            if (!isFirst)
                writer.write(ASP2CoreSymbols.CONJUNCTION);

            OWLClass guard = getNominalGuard(individual.asOWLNamedIndividual());
            visit(guard);
            isFirst=false;
        }
    }
}
项目:Wolpertinger    文件:NaiveTranslation.java   
/**
 * We assume that we deal with a normalized axioms, i.e. they are in NNF and structural transformation took place.
 *
 * Thereofre we test here whether the operand
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectComplementOf)
 */

public void visit(OWLObjectComplementOf objComplementOf) {
    OWLClassExpression operand = objComplementOf.getOperand();

    if (operand instanceof OWLClass) {
        OWLClass owlClass = operand.asOWLClass();
        String predicateName = mapper.getPredicateName(owlClass);

        writer.print(predicateName);
        writer.print(ASP2CoreSymbols.BRACKET_OPEN);
        writer.print(var.currentVar());
        writer.print(ASP2CoreSymbols.BRACKET_CLOSE);

        if (isAuxiliaryClass(owlClass)) auxClasses.add(owlClass);
    }
    else if (operand instanceof OWLObjectHasSelf) {
        OWLObjectHasSelf owlHasSelf = (OWLObjectHasSelf) operand;
        OWLObjectProperty property = owlHasSelf.getProperty().asOWLObjectProperty();
        String propertyName = mapper.getPredicateName(property);
        String cVar = var.currentVar();

        // r(X,X)
        writer.print(propertyName);
        writer.print(ASP2CoreSymbols.BRACKET_OPEN);
        writer.print(cVar);
        writer.print(ASP2CoreSymbols.ARG_SEPERATOR);
        writer.print(cVar);
        writer.print(ASP2CoreSymbols.BRACKET_CLOSE);
    }
    else if (operand instanceof OWLObjectOneOf) {
        throw new NotImplementedException();
    }
}
项目:Wolpertinger    文件:NaiveTranslation.java   
/**
 *
 * @see org.semanticweb.owlapi.model.OWLClassExpressionVisitor#visit(org.semanticweb.owlapi.model.OWLObjectOneOf)
 */

public void visit(OWLObjectOneOf owlOneOf) {
    boolean isFirst=true;
    for (OWLIndividual individual : owlOneOf.getIndividuals()) {
        if (individual.isNamed()){
            if (!isFirst)
                writer.write(ASP2CoreSymbols.CONJUNCTION);

            OWLClass guard = getNominalGuard(individual.asOWLNamedIndividual());
            visit(guard);
            isFirst=false;
        }
    }
}
项目:jcel    文件:ClassExpressionTranslator.java   
@Override
public IntegerClassExpression visit(OWLObjectOneOf ce) {
    Objects.requireNonNull(ce);
    Set<OWLIndividual> indivSet = ce.getIndividuals();
    if (indivSet.isEmpty()) {
        throw new TranslationException("It is not possible to translate ObjectOneOf with empty set.");
    }
    if (indivSet.size() > 1) {
        throw new TranslationException(
                "It is not possible to translate ObjectOneOf with multiple individuals: '" + indivSet + "'.");
    }
    return getDataTypeFactory().createObjectOneOf(translateIndividual(indivSet.iterator().next()));
}
项目:jcel    文件:ReverseAxiomTranslator.java   
@Override
public OWLAxiom visit(NominalAxiom axiom) {
    Objects.requireNonNull(axiom);
    OWLNamedIndividual owlIndividual = translator.getTranslationRepository()
            .getOWLNamedIndividual(axiom.getIndividual());
    OWLClass owlClass = translator.getTranslationRepository().getOWLClass(axiom.getClassExpression());
    Set<OWLAnnotation> owlAnnotations = translateAnnotations(axiom.getAnnotations());
    OWLDataFactory dataFactory = ontology.getOWLOntologyManager().getOWLDataFactory();
    OWLObjectOneOf owlObjectOneOf = dataFactory.getOWLObjectOneOf(owlIndividual);
    Set<OWLClassExpression> owlClassExpressions = new HashSet<>();
    owlClassExpressions.add(owlObjectOneOf);
    owlClassExpressions.add(owlClass);
    return dataFactory.getOWLEquivalentClassesAxiom(owlClassExpressions, owlAnnotations);
}
项目:owlapi-gwt    文件:NNF.java   
@Override
public OWLClassExpression visit(OWLObjectOneOf ce) {
    if (ce.getIndividuals().size() == 1) {
        if (negated) {
            return getNegation(ce);
        } else {
            return ce;
        }
    } else {
        return ce.asObjectUnionOf().accept(this);
    }
}
项目:owlapi-gwt    文件:OWLObjectOneOfImpl.java   
@Override
public boolean equals(Object obj) {
    if (!(obj instanceof OWLObjectOneOf)) {
        return false;
    }
    return ((OWLObjectOneOf) obj).getIndividuals().equals(values);
}
项目:OWLAx    文件:IntegrateOntologyWithProtege.java   
/**
 * create axioms for class--objectproperty----individual relation.
 * 
 * @param src
 * @param objprop
 * @param dest
 * @return
 */
private void getClass2ObjectProperty2IndividualAxioms(OWLClass src, OWLObjectProperty objprop, OWLIndividual dest) {
    // Set<OWLAxiom> tmpaxioms = new HashSet<OWLAxiom>();
    OWLAxiom axiom;
    OWLObjectSomeValuesFrom owlObjectSomeValuesFrom;
    OWLObjectHasValue owlLObjectHasValue;
    OWLObjectMaxCardinality owlObjectMaxCardinality;
    OWLObjectOneOf owlObjectOneOf;

    // set domain and range
    // scoped domain
    if (editor.isGenerateDomainAxiom()) {
        owlLObjectHasValue = owlDataFactory.getOWLObjectHasValue(objprop, dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlLObjectHasValue, src);
        domainAndRangeAxioms.add(axiom);

        owlObjectSomeValuesFrom = owlDataFactory.getOWLObjectSomeValuesFrom(objprop, owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlObjectSomeValuesFrom, src);
        domainAndRangeAxioms.add(axiom);
    }

    // set existential restriction
    if (editor.isGenerateExistentialAxiom()) {
        owlObjectSomeValuesFrom = owlDataFactory.getOWLObjectSomeValuesFrom(objprop.getInverseProperty(), src);
        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlObjectOneOf, owlObjectSomeValuesFrom);
        existentialAxioms.add(axiom);

        owlLObjectHasValue = owlDataFactory.getOWLObjectHasValue(objprop, dest);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlLObjectHasValue);
        existentialAxioms.add(axiom);
    }

    // set cardinality restriction
    if (editor.isGenerateCardinalityAxiom()) {
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop,
                owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataFactory.getOWLThing(), owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop,
                owlDataFactory.getOWLThing());
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop, owlObjectOneOf);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);

        owlObjectOneOf = owlDataFactory.getOWLObjectOneOf(dest);
        owlObjectMaxCardinality = owlDataFactory.getOWLObjectMaxCardinality(1, objprop, owlObjectOneOf);
        axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataFactory.getOWLThing(), owlObjectMaxCardinality);
        cardinalityAxioms.add(axiom);
    }
    // return tmpaxioms;
}
项目:jopa    文件:IntegrityConstraintClassParser.java   
public void visit(OWLObjectOneOf arg0) {
    notSupported(arg0);
}
项目:HermiT-android    文件:BuiltInPropertyManager.java   
public void visit(OWLObjectOneOf object) {
}
项目:HermiT-android    文件:OWLNormalization.java   
protected static boolean isNominal(OWLClassExpression description) {
    return description instanceof OWLObjectOneOf;
}
项目:HermiT-android    文件:OWLNormalization.java   
public OWLClassExpression visit(OWLObjectOneOf object) {
    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;
}