Java 类org.semanticweb.owlapi.model.OWLClassExpression 实例源码
项目:owltools
文件:TemplatedTransformer.java
/**
* Replace inx using m
*
* @param inx
* @param m
* @return
*/
private OWLClassExpression replace(OWLClassExpression inx,
Mapping m) {
LOG.info("Testing: "+inx+" for mapping using "+m);
// test to see if there is a match between the src pattern in
// the mapping and the input expression
BindingSet bset = unifyAll(inx, m.src, m.vars);
if (bset == null) {
// no match
LOG.info("No match for: "+inx);
return null;
}
LOG.info("Unified. Bindings: "+bset);
return replaceVariables(inx, bset);
}
项目:owltools
文件:CompositionalClassPredictor.java
private void buildSimpleDefMap() {
simpleDefMap = new HashMap<OWLClass,Set<OWLClassExpression>>();
OWLOntology o = getGraph().getSourceOntology();
for (OWLClass c : o.getClassesInSignature()) {
for (OWLEquivalentClassesAxiom eca : o.getEquivalentClassesAxioms(c)) {
Set<OWLClassExpression> elts = new HashSet<OWLClassExpression>();
for (OWLClassExpression x : eca.getClassExpressions()) {
// assume one logical definitionper class - otherwise choose arbitrary
if (x instanceof OWLObjectIntersectionOf) {
if (getReachableOWLClasses(x, elts) && elts.size() > 0) {
//LOG.info(c+" def= "+elts);
simpleDefMap.put(c, elts);
}
}
}
}
}
}
项目: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
文件: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
文件: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()));
}
}
}
项目:Hermit_1.3.8_android
文件:EntailmentChecker.java
public void visit(OWLDataPropertyAssertionAxiom axiom) {
if (!axiom.getSubject().isAnonymous()) {
return; // not interesting for the anonymous individual forest
}
OWLAnonymousIndividual sub=axiom.getSubject().asOWLAnonymousIndividual();
nodes.add(sub);
OWLClassExpression c=factory.getOWLDataHasValue(axiom.getProperty(),axiom.getObject());
if (nodelLabels.containsKey(sub)) {
nodelLabels.get(sub).add(c);
}
else {
Set<OWLClassExpression> labels=new HashSet<OWLClassExpression>();
labels.add(c);
nodelLabels.put(sub,labels);
}
}
项目:owltools
文件:GraphReasoner.java
/**
* note that this is not a standard reasoner method
*
* @param ce
* @param direct
* @return all superclasses, where superclasses can include anon class expressions
* @throws InconsistentOntologyException
* @throws ClassExpressionNotInProfileException
* @throws FreshEntitiesException
* @throws ReasonerInterruptedException
* @throws TimeOutException
*/
public Set<OWLClassExpression> getSuperClassExpressions(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
Set<OWLClassExpression> result = new HashSet<OWLClassExpression>();
Set<OWLObject> supers = gw.getSubsumersFromClosure(ce);
for (OWLObject sup : supers) {
if (sup instanceof OWLClassExpression) {
result.add((OWLClassExpression) sup);
}
else {
}
}
return result;
}
项目:owltools
文件:AbstractReasonerTest.java
protected Set<OWLClass> findDescendants(OWLReasoner r, String expr, Integer numExpected) throws TimeOutException, FreshEntitiesException, InconsistentOntologyException, ClassExpressionNotInProfileException, ReasonerInterruptedException, OWLParserException {
System.out.println("Query: "+expr);
OWLClassExpression qc = parseOMN(expr);
Set<OWLClass> clzs = r.getSubClasses(qc, false).getFlattened();
clzs.remove(r.getRootOntology().getOWLOntologyManager().getOWLDataFactory().getOWLNothing());
if (!qc.isAnonymous())
clzs.add((OWLClass) qc);
System.out.println("NumD:"+clzs.size());
for (OWLClass c : clzs) {
System.out.println(" D:"+c);
}
if (numExpected != null) {
assertEquals(numExpected.intValue(), clzs.size());
}
return clzs;
}
项目:minerva
文件:M3ExpressionParserTest.java
@Test
public void testParseClazzNoCheckLiteralIds() throws Exception {
JsonOwlObject expression = new JsonOwlObject();
expression.type = JsonOwlObjectType.Class;
expression.id = "GO:23"; // valid prefix, not a known class
// create a parser that explicitly disables checking so-called literal ids
OWLClassExpression ce = new M3ExpressionParser(false, curieHandler).parse(graph, expression, null);
// check the retrieved class is the same as the input
// note: we don't use the owltools getClass method directly, as that depends on the class
// being known
IRI iri = graph.getIRIByIdentifier("GO:23");
assertEquals(iri, ce.asOWLClass().getIRI());
}
项目:owltools
文件:GraphReasoner.java
public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
boolean direct) throws InconsistentOntologyException,
ClassExpressionNotInProfileException, FreshEntitiesException,
ReasonerInterruptedException, TimeOutException {
DefaultNodeSet<OWLClass> result = new OWLClassNodeSet();
Set<OWLObject> supers = gw.getSubsumersFromClosure(ce);
for (OWLObject sup : supers) {
if (sup instanceof OWLClassExpression) {
if (sup instanceof OWLClass) {
result.addEntity((OWLClass) sup);
}
else {
}
}
else {
}
}
return result;
}
项目:minerva
文件:CoreMolecularModelManager.java
private static Pair<OWLNamedIndividual, Set<OWLAxiom>> createIndividualInternal(IRI iri, OWLOntology abox, OWLClassExpression ce, Set<OWLAnnotation> annotations) {
LOG.info("Generating individual for IRI: "+iri);
OWLDataFactory f = abox.getOWLOntologyManager().getOWLDataFactory();
OWLNamedIndividual i = f.getOWLNamedIndividual(iri);
// create axioms
Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
// declaration
axioms.add(f.getOWLDeclarationAxiom(i));
// annotation assertions
if(annotations != null) {
for(OWLAnnotation annotation : annotations) {
axioms.add(f.getOWLAnnotationAssertionAxiom(iri, annotation));
}
}
if (ce != null) {
OWLClassAssertionAxiom typeAxiom = createType(f, i, ce);
if (typeAxiom != null) {
axioms.add(typeAxiom);
}
}
return Pair.of(i, axioms);
}
项目: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
文件: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;
*/
}
项目:minerva
文件:MolecularModelJsonRendererTest.java
static OWLClassExpression parse(OWLGraphWrapper g, JsonOwlObject[] expressions, JsonOwlObjectType type)
throws Exception {
if (expressions.length == 0) {
throw new Exception("Missing expressions: empty expression list is not allowed.");
}
if (expressions.length == 1) {
return parse(g, expressions[0]);
}
Set<OWLClassExpression> clsExpressions = new HashSet<OWLClassExpression>();
for (JsonOwlObject m3Expression : expressions) {
OWLClassExpression ce = parse(g, m3Expression);
clsExpressions.add(ce);
}
if (type == JsonOwlObjectType.UnionOf) {
return g.getDataFactory().getOWLObjectUnionOf(clsExpressions);
}
else if (type == JsonOwlObjectType.IntersectionOf) {
return g.getDataFactory().getOWLObjectIntersectionOf(clsExpressions);
}
else {
throw new UnknownIdentifierException("Unsupported expression type: "+type);
}
}
项目:owltools
文件:Sim2CommandRunner.java
@CLIMethod("--remove-dangling-annotations")
public void removeDangningAnnotations(Opts opts) throws Exception {
OWLOntology ont = g.getSourceOntology();
int n = 0;
Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
for (OWLClassAssertionAxiom ca : ont.getClassAssertionAxioms(i)) {
OWLClassExpression cx = ca.getClassExpression();
if (cx instanceof OWLClass) {
OWLClass c = (OWLClass) cx;
String label = g.getLabel(c);
if (label == null)
rmAxioms.add(ca);
else
n++;
}
}
}
LOG.info("Removing " + rmAxioms.size() + " axioms");
ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
LOG.info("Remaining: " + n + " axioms");
}
项目:owltools
文件:TBoxUnFoldingTool.java
UnfoldingVisitor(Set<OWLClass> unfoldClasses, OWLOntology ontology) throws NonDeterministicUnfoldException {
this.unfoldClasses = new HashMap<OWLClass, OWLClassExpression>();
factory = ontology.getOWLOntologyManager().getOWLDataFactory();
for(OWLClass owlClass : unfoldClasses) {
Set<OWLEquivalentClassesAxiom> eqAxioms = ontology.getEquivalentClassesAxioms(owlClass);
if (eqAxioms != null && !eqAxioms.isEmpty()) {
if(eqAxioms.size() > 1) {
throw new NonDeterministicUnfoldException("Non deterministic unfold for class: "+owlClass.getIRI());
}
OWLEquivalentClassesAxiom eqAxiom = eqAxioms.iterator().next();
Set<OWLClassExpression> expressions = eqAxiom.getClassExpressionsMinus(owlClass);
if (expressions.size() == 1) {
this.unfoldClasses.put(owlClass, expressions.iterator().next());
}
else if (expressions.size() > 1) {
OWLClassExpression ce = factory.getOWLObjectIntersectionOf(expressions);
this.unfoldClasses.put(owlClass, ce);
}
}
}
// TODO check that there are no cycles in the unfold expressions, otherwise this unfold will not terminate!
}
项目: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>");
}
}
项目:pronto
文件:KBEmbeddedLoader.java
private void addAutoGeneratedClassNames(OWLOntologyManager manager,
OWLOntology ontology,
Map<String, OWLClassExpression> nameMap) {
OWLDataFactory factory = manager.getOWLDataFactory();
List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
for (Map.Entry<String, OWLClassExpression> entry : nameMap.entrySet()) {
OWLClass subClass = factory.getOWLClass( IRI.create(entry.getKey()) );
OWLAxiom declAxiom = factory.getOWLEquivalentClassesAxiom( subClass, entry.getValue() );
changes.addAll( manager.addAxiom( ontology, declAxiom ) );
}
manager.applyChanges( changes );
}
项目:elk-reasoner
文件:ProofTest.java
@Test
public void emptyDisjointUnion() throws Exception {
OWLOntologyManager owlManager = OWLManager
.createConcurrentOWLOntologyManager();
// creating an ontology
final OWLOntology ontology = owlManager.createOntology();
OWLClass a = factory.getOWLClass(IRI.create("http://example.org/A"));
OWLClass b = factory.getOWLClass(IRI.create("http://example.org/B"));
// DisjointUnion(A ) = EquivalentClasses(A owl:Nothing)
owlManager.addAxiom(ontology, factory.getOWLDisjointUnionAxiom(a,
Collections.<OWLClassExpression> emptySet()));
owlManager.addAxiom(ontology, factory.getOWLSubClassOfAxiom(b, b));
final OWLProver prover = OWLAPITestUtils.createProver(ontology);
prover.precomputeInferences(InferenceType.CLASS_HIERARCHY);
ProofTestUtils.provabilityTest(prover,
factory.getOWLSubClassOfAxiom(a, b));
}
项目:owltools
文件:SimpleABoxToGAF.java
public Set<GeneAnnotation> generateAssociations(OWLNamedIndividual ind, OWLOntology ont) {
Set<GeneAnnotation> assocs = new HashSet<GeneAnnotation>();
String eid = graph.getIdentifier(ind);
for (OWLClassExpression x : OwlHelper.getTypes(ind, ont)) {
GeneAnnotation ga = new GeneAnnotation();
if (x.isAnonymous()) {
// TODO
}
else {
ga.setCls(graph.getIdentifier(x));
}
ga.setBioentity(eid);
assocs.add(ga);
}
return assocs;
}
项目:Hermit_1.3.8_android
文件:EntailmentChecker.java
public void visit(OWLClassAssertionAxiom axiom) {
if (axiom.getClassExpression().isOWLThing())
return;
OWLIndividual node=axiom.getIndividual();
if (!node.isAnonymous()) {
namedNodes.add(node.asOWLNamedIndividual());
}
else {
nodes.add(node.asOWLAnonymousIndividual());
if (nodelLabels.containsKey(node)) {
nodelLabels.get(node).add(axiom.getClassExpression());
}
else {
Set<OWLClassExpression> label=new HashSet<OWLClassExpression>();
label.add(axiom.getClassExpression());
nodelLabels.put(node.asOWLAnonymousIndividual(),label);
}
}
}
项目:owltools
文件:CardinalityContraintsTools.java
@Override
public void visit(OWLEquivalentClassesAxiom axiom) {
Set<OWLClassExpression> newExpressions = new HashSet<OWLClassExpression>();
boolean changed = false;
for (OWLClassExpression ce : axiom.getClassExpressions()) {
HandlerResult result = ce.accept(handler);
if (result != null) {
if (result.remove) {
// skip handling and immediately remove and return
remove(ontology, axiom);
return;
}
changed = true;
newExpressions.add(result.modified);
}
else {
newExpressions.add(ce);
}
}
if (changed) {
remove(ontology, axiom);
OWLEquivalentClassesAxiom newAxiom = factory.getOWLEquivalentClassesAxiom(newExpressions, axiom.getAnnotations());
add(ontology, newAxiom);
}
}
项目:geoxygene
文件:OntologyBrowser.java
private void addSubClasses(DefaultMutableTreeNode node) {
OWLClass owlClass = (OWLClass) node.getUserObject();
for (OWLClassExpression c : owlClass.getSubClasses(this.ontology)) {
if (!OWLClass.class.isInstance(c)) {
continue;
}
OWLClass subClass = (OWLClass) c;
DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(subClass);
node.add(subNode);
if (subClass.getSubClasses(this.ontology).size() != 0) {
this.addSubClasses(subNode);
}
}
}
项目:Wolpertinger
文件:ExpressionManager.java
public OWLClassExpression visit(OWLObjectComplementOf d) {
OWLClassExpression operandSimplified=getSimplified(d.getOperand());
if (operandSimplified.isOWLThing())
return m_factory.getOWLNothing();
else if (operandSimplified.isOWLNothing())
return m_factory.getOWLThing();
else if (operandSimplified instanceof OWLObjectComplementOf)
return ((OWLObjectComplementOf)operandSimplified).getOperand();
else
return m_factory.getOWLObjectComplementOf(operandSimplified);
}
项目:owltools
文件:Mooncat.java
/**
* For every pair X DisjointWith Y, generate an axiom
* A and Y = Nothing
*
* (may become deprecated after Elk supports disjoints)
*
* @param ont
* @param manager
* @param dataFactory
*/
public static void translateDisjointsToEquivalents(OWLOntology ont, OWLOntologyManager manager, OWLDataFactory dataFactory) {
for (OWLDisjointClassesAxiom dca : ont.getAxioms(AxiomType.DISJOINT_CLASSES, Imports.INCLUDED)) {
for (OWLClassExpression ce1 : dca.getClassExpressions()) {
for (OWLClassExpression ce2 : dca.getClassExpressions()) {
if (ce1.compareTo(ce2) <= 0)
continue;
OWLEquivalentClassesAxiom eca = dataFactory.getOWLEquivalentClassesAxiom(dataFactory.getOWLNothing(),
dataFactory.getOWLObjectIntersectionOf(ce1, ce2));
manager.addAxiom(ont, eca);
// TODO - remove if requested
}
}
}
}
项目:Wolpertinger
文件:DebugTranslation.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);
}
项目:uel
文件:OWLRenderer.java
@Override
protected OWLClassExpression translateExistentialRestriction(String roleName, Integer childId) {
OWLClassExpression child = translateChild(childId);
OWLObjectProperty property = dataFactory.getOWLObjectProperty(IRI.create(roleName));
expr = dataFactory.getOWLObjectSomeValuesFrom(property, child);
return expr;
}
项目:owltools
文件:SubclassRetriever.java
public SubclassRetriever(OWLClass initialClass, OWLOntology sourceOntology) {
subClasses = new HashMap<IRI, OWLClass>();
Set<OWLClassExpression> subClss = OwlHelper.getSubClasses(initialClass, sourceOntology);
for (OWLClassExpression subCls : subClss) {
subClasses.put(subCls.asOWLClass().getIRI(), subCls.asOWLClass());
retrieveSubClasses(subCls.asOWLClass(), sourceOntology);
}
}
项目:uel
文件:UelOntology.java
public Set<Integer> processClassExpression(OWLClassExpression expression, Set<Definition> newDefinitions) {
Set<Integer> toVisit = new HashSet<>();
Set<Integer> conjunction = flattenClassExpression(expression, newDefinitions, toVisit);
while (!toVisit.isEmpty()) {
Integer nameId = toVisit.iterator().next();
if (!visited.contains(nameId)) {
loadFlatDefinition(nameId, newDefinitions, toVisit);
visited.add(nameId);
toVisit.remove(nameId);
}
}
return conjunction;
}
项目:owltools
文件:TBoxUnFoldingTool.java
@Override
public OWLObjectSomeValuesFrom visit(OWLObjectSomeValuesFrom ce) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unfolding some_values_from: "+ce);
}
OWLClassExpression filler = ce.getFiller();
if (filler != null) {
OWLClassExpression unfold = filler.accept(this);
if (unfold != null) {
return factory.getOWLObjectSomeValuesFrom(ce.getProperty(), unfold);
}
}
return null;
}
项目:owltools
文件:TBoxUnFoldingTool.java
@Override
public OWLObjectAllValuesFrom visit(OWLObjectAllValuesFrom ce) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unfolding all_values_from: "+ce);
}
OWLClassExpression filler = ce.getFiller();
if (filler != null) {
OWLClassExpression unfold = filler.accept(this);
if (unfold != null) {
return factory.getOWLObjectAllValuesFrom(ce.getProperty(), unfold);
}
}
return null;
}
项目:uel
文件:UelOntologyGoal.java
private <T extends Axiom> T createAxiom(Class<T> type, OWLClassExpression left, OWLClassExpression right) {
Set<Definition> newDefinitions = new HashSet<>();
Set<Integer> leftIds = ontology.processClassExpression(left, newDefinitions);
Set<Integer> rightIds = ontology.processClassExpression(right, newDefinitions);
T newAxiom;
try {
newAxiom = type.getConstructor(Set.class, Set.class).newInstance(leftIds, rightIds);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e);
}
processDefinitions(newDefinitions);
return newAxiom;
}
项目:owltools
文件:TBoxUnFoldingTool.java
@Override
public OWLObjectComplementOf visit(OWLObjectComplementOf ce) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unfolding complement_of: "+ce);
}
OWLClassExpression operand = ce.getOperand();
if (operand != null) {
OWLClassExpression unfold = operand.accept(this);
if (unfold != null) {
return factory.getOWLObjectComplementOf(unfold);
}
}
return null;
}
项目:Hermit_1.3.8_android
文件:ExpressionManager.java
public OWLClassExpression visit(OWLObjectExactCardinality d) {
OWLClassExpression filler=getSimplified(d.getFiller());
if (d.getCardinality()<0)
return m_factory.getOWLNothing();
else if (d.getCardinality()==0)
return m_factory.getOWLObjectAllValuesFrom(d.getProperty().getSimplified(),m_factory.getOWLObjectComplementOf(filler));
else if (filler.isOWLNothing())
return m_factory.getOWLNothing();
else {
OWLObjectMinCardinality minCardinality=m_factory.getOWLObjectMinCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
OWLObjectMaxCardinality maxCardinality=m_factory.getOWLObjectMaxCardinality(d.getCardinality(),d.getProperty().getSimplified(),filler);
return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality);
}
}
项目:Wolpertinger
文件:ExpressionManager.java
public OWLClassExpression visit(OWLObjectMinCardinality d) {
if (d.getCardinality()==0)
return m_factory.getOWLNothing();
else {
OWLClassExpression filler=getNNF(d.getFiller());
return m_factory.getOWLObjectMaxCardinality(d.getCardinality()-1,d.getProperty().getSimplified(),filler);
}
}
项目:Hermit_1.3.8_android
文件:ExpressionManager.java
public OWLClassExpression visit(OWLDataExactCardinality d) {
OWLDataRange filler=getSimplified(d.getFiller());
if (d.getCardinality()<0)
return m_factory.getOWLNothing();
else if (d.getCardinality()==0)
return m_factory.getOWLDataAllValuesFrom(d.getProperty(),m_factory.getOWLDataComplementOf(filler));
else if (isBottomDataRange(filler))
return m_factory.getOWLNothing();
else {
OWLDataMinCardinality minCardinality=m_factory.getOWLDataMinCardinality(d.getCardinality(),d.getProperty(),filler);
OWLDataMaxCardinality maxCardinality=m_factory.getOWLDataMaxCardinality(d.getCardinality(),d.getProperty(),filler);
return m_factory.getOWLObjectIntersectionOf(minCardinality,maxCardinality);
}
}
项目:owltools
文件:ModelAnnotationSolrDocumentLoader.java
private OWLClass findFirstType(OWLNamedIndividual relevant) {
Set<OWLClassAssertionAxiom> axioms = model.getClassAssertionAxioms(relevant);
for (OWLClassAssertionAxiom axiom : axioms) {
OWLClassExpression ce = axiom.getClassExpression();
if (ce.isAnonymous() == false) {
return ce.asOWLClass();
}
}
return null;
}
项目:elk-reasoner
文件:ElkDisjointUnionAxiomWrap.java
@Override
public List<? extends ElkClassExpression> getClassExpressions() {
List<ElkClassExpression> result = new ArrayList<ElkClassExpression>();
for (OWLClassExpression ce : this.owlObject.getClassExpressions()) {
result.add(converter.convert(ce));
}
return result;
}
项目:born
文件:BornReasoner.java
@Override
public Node<OWLClass> getEquivalentClasses(OWLClassExpression classExpression) {
Objects.requireNonNull(classExpression);
logger.finer("getEquivalentClasses(" + classExpression + ")");
throw new UnsupportedReasonerOperationInBornException(
"Unsupported operation : getEquivalentClasses(OWLClassExpression)");
}
项目: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
}
}