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 processQueue() { int startingSize = queue.size(); while( !queue.isEmpty() ) { int processed = startingSize - queue.size(); if( monitor.getProgress() < processed ) monitor.setProgress( processed ); MultiValueMap<ConceptInfo, Trigger> localQueue = queue; queue = new MultiValueMap<ConceptInfo, Trigger>(); for (Entry<ConceptInfo, Set<Trigger>> entry : localQueue.entrySet()) { ConceptInfo ci = entry.getKey(); for (Trigger trigger : entry.getValue()) { processTrigger(ci, trigger); } } } }
private Bool checkDisjointPropertyClash(CachedNode root1, CachedNode root2) { MultiValueMap<ATermAppl, Role> neighbors1 = collectNeighbors( root1 ); if( neighbors1.isEmpty() ) return null; MultiValueMap<ATermAppl, Role> neighbors2 = collectNeighbors( root2 ); if( neighbors2.isEmpty() ) return null; for( Entry<ATermAppl, Set<Role>> e : neighbors1.entrySet() ) { ATermAppl commonNeighbor = e.getKey(); Set<Role> roles1 = e.getValue(); Set<Role> roles2 = neighbors2.get( commonNeighbor ); if( roles2 == null ) continue; if( checkDisjointProperties( roles1, roles2 ) ) return Bool.UNKNOWN; } return null; }
private void processDeletions() { for( OWLAxiom axiom : deletions ) { Set<OWLEntity> entities = axiomEntities.remove( axiom ); for( OWLEntity entity : entities ) { entityAxioms.remove( entity, axiom ); if( !entityAxioms.containsKey( entity ) ) { if( log.isLoggable( Level.FINE ) ) log.fine( "Remove " + entity + " which is not mentioned anymore" ); allClasses.remove( entity ); modules.remove( entity ); } } } }
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 ); } } } }
/** * Clear the visitor cache about simple properties. Should be called before * a reload. */ public void clear() { unsupportedAxioms = new HashSet<OWLAxiom>(); compositePropertyAxioms = new MultiValueMap<OWLObjectProperty, OWLObjectPropertyAxiom>(); simpleProperties = new HashSet<OWLObjectProperty>(); }
Iterator<ConceptInfo> preds = sub.getPredecessors().flattenedValues(); while( preds.hasNext() ) { addToQueue( preds.next(), sup ); Set<ConceptInfo> referredConjunctions = conjunctions.get( sup ); if( referredConjunctions != null ) { for( ConceptInfo conjunction : referredConjunctions ) { for( Entry<ATermAppl, Set<ConceptInfo>> e : sub.getPredecessors().entrySet() ) { ATermAppl prop = e.getKey(); if( MATERIALIZE_SUPER_PROPERTIES ) { Set<Role> superRoles = role.getSuperRoles(); for( Role superRole : superRoles ) { if( existentials.contains( superRole.getName(), sup ) ) { ATermAppl some = ATermUtils.makeSomeValues( superRole.getName(), c ); for( ConceptInfo pred : e.getValue() ) {
rules = kb.rules; aboxAssertions = new MultiValueMap<AssertionType, ATermAppl>(); Set<ATermAppl> assertions = kb.aboxAssertions.get( assertionType ); if( !assertions.isEmpty() ) aboxAssertions.put( assertionType, new HashSet<ATermAppl>( assertions ) );
Iterator<ConceptInfo> preds = ci.getPredecessors().flattenedValues(); while( preds.hasNext() ) { addSubsumer( preds.next(), supInfo ); for( Map.Entry<ATermAppl, Set<ConceptInfo>> e : ci.getPredecessors().entrySet() ) { ATermAppl prop = e.getKey(); for( ConceptInfo pred: e.getValue() ) {
/** * Get the entities referenced in this axiom * * @param axiom * @return */ protected Set<OWLEntity> getSignature(OWLAxiom axiom) { return axiomEntities.get( axiom ); }
public Taxonomy<ATermAppl> build(MultiValueMap<ATermAppl, ATermAppl> subsumers) { this.subsumers = subsumers; taxonomy = new Taxonomy<ATermAppl>( null, ATermUtils.TOP, ATermUtils.BOTTOM ); for( ATermAppl subsumer : subsumers.get( ATermUtils.TOP ) ) { if( ATermUtils.isPrimitive( subsumer ) ) taxonomy.addEquivalentNode( subsumer, taxonomy.getTop() ); } for( Entry<ATermAppl, Set<ATermAppl>> entry : subsumers.entrySet() ) { ATermAppl c = entry.getKey(); if( ATermUtils.isPrimitive( c ) ) { if( entry.getValue().contains( ATermUtils.BOTTOM ) ) { taxonomy.addEquivalentNode( c, taxonomy.getBottom() ); } else { add( c ); } } } return taxonomy; }
Set<Role> superRoles = kb.getRole( p ).getSuperRoles(); for( Role superRole : superRoles ) { if( existentials.contains( superRole.getName(), succ ) ) { ATermAppl some = ATermUtils.makeSomeValues( superRole.getName(), succ.getConcept() ); addToQueue( pred, concepts.get( some ) ); for (Entry<ATermAppl, Set<ConceptInfo>> entry : CollectionUtils.makeList(pred.getPredecessors().entrySet())) { ATermAppl predProp = entry.getKey(); for (ATermAppl supProp : roleChains.getAllSuperRoles(predProp, p)) { for (Entry<ATermAppl, Set<ConceptInfo>> entry : CollectionUtils.makeList(succ.getSuccessors().entrySet())) { ATermAppl succProp = entry.getKey(); for (ATermAppl supProp : roleChains.getAllSuperRoles(p, succProp)) {
private OWLEntity extractModuleSignature(OWLEntity entity, Set<OWLEntity> stackElements, List<OWLEntity> currentCycle, Set<OWLEntity> module) { assert !modules.containsKey( entity ) : "po already contained entity"; stackElements.add( entity ); modules.put( entity, module ); if( !modules.containsKey( member ) ) { module.addAll( modules.get( member ) ); modules.put( e, module );
private MultiValueMap<ATermAppl, Role> collectNeighbors(CachedNode ind) { MultiValueMap<ATermAppl, Role> neighbors = new MultiValueMap<ATermAppl, Role>(); for( Edge edge : ind.getInEdges() ) { Role role = edge.getRole(); ATermAppl neighbor = edge.getFromName(); if( !ATermUtils.isBnode( neighbor ) ) neighbors.put( neighbor, Collections.singleton(role) ); } for( Edge edge : ind.getOutEdges() ) { Role role = edge.getRole(); ATermAppl neighbor = edge.getToName(); if( role.isObjectRole() && !ATermUtils.isBnode( neighbor ) ) neighbors.put( neighbor, Collections.singleton(role.getInverse()) ); } return neighbors; }
/** * Saves the information about modules from ModuleExtractor to an output stream as an ontology of modules annotated with URIs of the OWL entities * that belong to the respective modules. * * @param modules the modules to be saved * @param outputStream the output stream where the data should be saved * @throws IOException if an error should occur during the save process */ public static void saveModules( MultiValueMap<OWLEntity, OWLEntity> modules, OutputStream outputStream ) throws IOException { PrintWriter pw = new PrintWriter( outputStream ); for ( Entry<OWLEntity, Set<OWLEntity>> entry : modules.entrySet() ) { OWLEntity entity = entry.getKey(); Set<OWLEntity> module = entry.getValue(); pw.println( getModuleBegin( entity ) ); for( OWLEntity member : module ) { pw.println( getModuleMember( member ) ); } pw.println( getModuleEnd() ); } pw.flush(); }
private MultiValueMap<ATermAppl, Role> collectNeighbors(CachedNode ind) { MultiValueMap<ATermAppl, Role> neighbors = new MultiValueMap<ATermAppl, Role>(); for( Edge edge : ind.getInEdges() ) { Role role = edge.getRole(); ATermAppl neighbor = edge.getFromName(); if( !ATermUtils.isBnode( neighbor ) ) neighbors.putSingle( neighbor, role ); } for( Edge edge : ind.getOutEdges() ) { Role role = edge.getRole(); ATermAppl neighbor = edge.getToName(); if( role.isObjectRole() && !ATermUtils.isBnode( neighbor ) ) neighbors.putSingle( neighbor, role.getInverse() ); } return neighbors; }
aboxAssertions.remove( AssertionType.TYPE, typeAxiom );
public boolean hasSuccessor(ATermAppl p, ConceptInfo ci) { return ci.predecessors.contains(p, this); }