本文整理汇总了Java中org.semanticweb.owlapi.model.OWLObjectOneOf类的典型用法代码示例。如果您正苦于以下问题:Java OWLObjectOneOf类的具体用法?Java OWLObjectOneOf怎么用?Java OWLObjectOneOf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLObjectOneOf类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLObjectOneOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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));
}
示例2: visit
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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;
*/
}
示例3: getOneOfAuxiliaryClass
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
/**
* 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;
}
示例4: getOneOfAuxiliaryClass
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
/**
* 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;
}
示例5: visit
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
@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;
}
示例6: addToOntology
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
@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));
}
示例7: addToOntology
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
@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));
}
示例8: addToOntology
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
@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));
}
示例9: axiomatizeTopObjectProperty
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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 });
}
示例10: OWLNormalization
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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>();
}
示例11: isNegatedOneNominal
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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;
}
示例12: getDefinitionForNegativeNominal
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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;
}
示例13: visit
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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;
}
示例14: OWLNormalization
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
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>();
}
示例15: visit
import org.semanticweb.owlapi.model.OWLObjectOneOf; //导入依赖的package包/类
/**
* 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();
}
}