private boolean add(ATermAppl r1, ATermAppl r2, ATermAppl superRole) { MultiValueMap<ATermAppl, ATermAppl> innerMap = m_BinaryRoleInclusions.get(r1); if (innerMap == null) { innerMap = new MultiValueMap<ATermAppl, ATermAppl>(); m_BinaryRoleInclusions.put(r1, innerMap); } return innerMap.add(r2, superRole); }
private boolean add(ATermAppl r1, ATermAppl r2, ATermAppl superRole) { MultiValueMap<ATermAppl, ATermAppl> innerMap = m_BinaryRoleInclusions.get(r1); if (innerMap == null) { innerMap = new MultiValueMap<ATermAppl, ATermAppl>(); m_BinaryRoleInclusions.put(r1, innerMap); } return innerMap.add(r2, superRole); }
private void processAdditions() { for( OWLAxiom axiom : additions ) { Set<OWLEntity> signature = OntologyUtils.getSignature( axiom ); axiomEntities.put( axiom, signature ); for( OWLEntity entity : signature ) { entityAxioms.add( entity, axiom ); if( entity instanceof OWLClass ) { OWLClass cls = (OWLClass) entity; allClasses.add( cls ); } } } }
/** * {@inheritDoc} */ protected MultiValueMap<ATermAppl, ATermAppl> getSubsumers(Set<Fact> facts) { MultiValueMap<ATermAppl, ATermAppl> subsumers = new MultiValueMap<ATermAppl, ATermAppl>(); for (Fact f : facts) { if (f.getElements().get(0).equals(PRED_SUB)) { List<ATermAppl> tuple = f.getElements(); ATermAppl c1 = tuple.get(1); ATermAppl c2 = tuple.get(2); if (ConstantStore.isAnon(c1) || ConstantStore.isAnon(c2)) continue; subsumers.add(c1, c2); } } return subsumers; }
protected MultiValueMap<ATermAppl, ATermAppl> run(Collection<ATermAppl> classes) { addClasses( classes ); addClasses( m_Names.getAllAnons() ); Reasoner reasoner = new GenericRuleReasoner(new ArrayList<Rule>(m_Rules)); InfGraph inf = reasoner.bind( m_Facts ); inf.prepare(); MultiValueMap<ATermAppl, ATermAppl> subsumers = getSubsumptions(inf); for( ATermAppl c : classes ) { subsumers.add( ATermUtils.BOTTOM, c ); } return subsumers; }
protected MultiValueMap<ATermAppl, ATermAppl> run(Collection<ATermAppl> classes) { addClasses( classes ); addClasses( m_Names.getAllAnons() ); Reasoner reasoner = new GenericRuleReasoner(new ArrayList<Rule>(m_Rules)); InfGraph inf = reasoner.bind( m_Facts ); inf.prepare(); MultiValueMap<ATermAppl, ATermAppl> subsumers = getSubsumptions(inf); for( ATermAppl c : classes ) { subsumers.add( ATermUtils.BOTTOM, c ); } return subsumers; }
public void addType(ATermAppl i, ATermAppl c) { if (AnnotationClasses.contains(c)) { return; } ATermAppl typeAxiom = ATermUtils.makeTypeAtom( i, c ); DependencySet ds = PelletOptions.USE_TRACING ? new DependencySet( typeAxiom ) : DependencySet.INDEPENDENT; // add type assertion to syntactic assertions and update dependency // index if( PelletOptions.USE_INCREMENTAL_DELETION ) { syntacticAssertions.add( typeAxiom ); dependencyIndex.addTypeDependency( i, c, ds ); } if( PelletOptions.KEEP_ABOX_ASSERTIONS ) aboxAssertions.add( AssertionType.TYPE, typeAxiom ); addType( i, c, ds ); }
public void addType(ATermAppl i, ATermAppl c) { if (AnnotationClasses.contains(c)) { return; } ATermAppl typeAxiom = ATermUtils.makeTypeAtom( i, c ); DependencySet ds = PelletOptions.USE_TRACING ? new DependencySet( typeAxiom ) : DependencySet.INDEPENDENT; // add type assertion to syntactic assertions and update dependency // index if( PelletOptions.USE_INCREMENTAL_DELETION ) { syntacticAssertions.add( typeAxiom ); dependencyIndex.addTypeDependency( i, c, ds ); } if( PelletOptions.KEEP_ABOX_ASSERTIONS ) aboxAssertions.add( AssertionType.TYPE, typeAxiom ); addType( i, c, ds ); }
@Override public void visit(OWLTransitiveObjectPropertyAxiom axiom) { if( !addAxioms ) { reloadRequired = true; return; } compositePropertyAxioms.add( getNamedProperty( axiom.getProperty() ), axiom ); axiom.getProperty().accept( this ); ATermAppl p = term; kb.addTransitiveProperty( p ); }
public void visit(OWLTransitiveObjectPropertyAxiom axiom) { if( !addAxioms ) { reloadRequired = true; return; } compositePropertyAxioms.add( getNamedProperty( axiom.getProperty() ), axiom ); axiom.getProperty().accept( this ); ATermAppl p = term; kb.addTransitiveProperty( p ); }
public void visit(OWLSubPropertyChainOfAxiom axiom) { if( !addAxioms ) { reloadRequired = true; return; } compositePropertyAxioms.add( getNamedProperty( axiom.getSuperProperty() ), axiom ); axiom.getSuperProperty().accept( this ); ATermAppl prop = result(); List<OWLObjectPropertyExpression> propChain = axiom.getPropertyChain(); ATermList chain = ATermUtils.EMPTY_LIST; for( int i = propChain.size() - 1; i >= 0; i-- ) { propChain.get( i ).accept( this ); chain = chain.insert( result() ); } kb.addSubProperty( chain, prop ); }
@Override public void visit(OWLSubPropertyChainOfAxiom axiom) { if( !addAxioms ) { reloadRequired = true; return; } compositePropertyAxioms.add( getNamedProperty( axiom.getSuperProperty() ), axiom ); axiom.getSuperProperty().accept( this ); ATermAppl prop = result(); List<OWLObjectPropertyExpression> propChain = axiom.getPropertyChain(); ATermList chain = ATermUtils.EMPTY_LIST; for( int i = propChain.size() - 1; i >= 0; i-- ) { propChain.get( i ).accept( this ); chain = chain.insert( result() ); } kb.addSubProperty( chain, prop ); }
protected MultiValueMap<ATermAppl, ATermAppl> run( Collection<ATermAppl> classes) { KnowledgeBase reteKB = new KnowledgeBase(); Interpreter interpreter = new Interpreter(reteKB.getABox()); for( Rule rule : m_Rules ) { interpreter.rete.compile(rule, null); } addClasses(interpreter, classes); addClasses(interpreter, m_Names.getAllAnons()); for (Fact fact : m_Facts) { interpreter.addFact(fact); } m_Facts = null; m_Names.reset(); Set<Fact> facts = interpreter.run(); MultiValueMap<ATermAppl, ATermAppl> subsumers = getSubsumers(facts); for (ATermAppl c : classes) { subsumers.add(c, c); subsumers.add(c, ATermUtils.TOP); } return subsumers; }
protected MultiValueMap<ATermAppl, ATermAppl> getSubsumptions(Graph graph) { MultiValueMap<ATermAppl, ATermAppl> subsumers = new MultiValueMap<ATermAppl, ATermAppl>(); ExtendedIterator it = graph.find(Node.ANY, PRED_SUB, Node.ANY); while (it.hasNext()) { Triple tri = (Triple) it.next(); Node sub = tri.getSubject(); Node sup = tri.getObject(); if (NameStore.isAnon(sub) || NameStore.isAnon(sup)) continue; subsumers.add(toATermAppl(sub), toATermAppl(sup)); } it.close(); return subsumers; }
protected MultiValueMap<ATermAppl, ATermAppl> getSubsumptions(Graph graph) { MultiValueMap<ATermAppl, ATermAppl> subsumers = new MultiValueMap<ATermAppl, ATermAppl>(); ExtendedIterator it = graph.find(Node.ANY, PRED_SUB, Node.ANY); while (it.hasNext()) { Triple tri = (Triple) it.next(); Node sub = tri.getSubject(); Node sup = tri.getObject(); if (NameStore.isAnon(sub) || NameStore.isAnon(sup)) continue; subsumers.add(toATermAppl(sub), toATermAppl(sup)); } it.close(); return subsumers; }