@Override public Set<OWLOntology> getDescendants(OWLOntology node) { return node.getImports(); }
" Imports = " + ontology.getImports()); Logger.getLogger(OwlUtility.class).debug( " Direct imports = " + ontology.getDirectImports());
public static Set<OWLOntology> getImportRoots(Set<OWLOntology> onts){ // TODO: handle cyclic imports Set<OWLOntology> roots = new HashSet<>(onts); for (OWLOntology ont : onts){ roots.removeAll(ont.getImports()); } return roots; }
@Override public boolean hasAncestor(OWLOntology node, OWLOntology ancestor) { return !node.equals(ancestor) && ancestor.getImports().contains(node); }
/** * Retrieves the triples from the imports closure that have not been consumed during parsing of ontologies in the * imports closure. * @return A set of unconsumed triples. */ private Set<RDFTriple> getUnconsumedTriplesFromImportsClosure() { Set<RDFTriple> unparsedTriples = new HashSet<RDFTriple>(); // Don't get the REFLEXIVE transitive closure - just the transitive closure. Set<OWLOntology> imports = ontology.getImports(); for (OWLOntology ont : imports) { unparsedTriples.addAll(getUnconsumedTriples(ont)); } return unparsedTriples; }
@Override public Set<OWLOntology> getAncestors(OWLOntology node) { Set<OWLOntology> ancestors = new HashSet<>(); for (OWLOntology ancestor : server.getOntologies()){ if (ancestor.getImports().contains(node)){ ancestors.add(ancestor); } } return ancestors; }
private boolean isRootOntologySingleton(@Nonnull OWLOntologyID ontologyId) { return rootOntology.getOntologyID().equals(ontologyId) && rootOntology.getImports().isEmpty(); }
for( OWLOntology importOnt : ontology.getImports() ) {
for( OWLOntology importOnt : ontology.getImports() ) {
/** * Use annotation properties and the short form provider to add mappings for all entities in the * given ontology. * * @param ontology the ontology to add mappings for */ public void addAll(OWLOntology ontology) { Set<OWLOntology> ontologies = new HashSet<>(); ontologies.add(ontology); ontologies.addAll(ontology.getImports()); ReferencedEntitySetProvider resp = new ReferencedEntitySetProvider(ontologies); for (OWLEntity entity : resp.getEntities()) { add(ontology, entity); } }
private int load(OWLOntology ontology, boolean imported, Collection<OWLOntology> toBeLoaded) { // if not imported add it to notImported set if( !imported ) notImported.add( ontology ); // add to the loaded ontologies boolean added = ontologies.add( ontology ); // if it was already there, nothing more to do if( !added ) return 0; int axiomCount = ontology.getAxioms().size(); toBeLoaded.add( ontology ); // if processing imports load the imported ontologies if( processImports ) { for( OWLOntology importedOnt : ontology.getImports() ) { // load the importedOnt axiomCount += load( importedOnt, true, toBeLoaded ); // update the import dependencies Set<OWLOntology> importees = importDependencies.get( importedOnt ); if( importees == null ) { importees = new HashSet<OWLOntology>(); importDependencies.put( importedOnt, importees ); } importees.add( ontology ); } } return axiomCount; }
private int load(OWLOntology ontology, boolean imported, Collection<OWLOntology> toBeLoaded) { // if not imported add it to notImported set if( !imported ) notImported.add( ontology ); // add to the loaded ontologies boolean added = ontologies.add( ontology ); // if it was already there, nothing more to do if( !added ) return 0; int axiomCount = ontology.getAxioms().size(); toBeLoaded.add( ontology ); // if processing imports load the imported ontologies if( processImports ) { for( OWLOntology importedOnt : ontology.getImports() ) { // load the importedOnt axiomCount += load( importedOnt, true, toBeLoaded ); // update the import dependencies Set<OWLOntology> importees = importDependencies.get( importedOnt ); if( importees == null ) { importees = new HashSet<OWLOntology>(); importDependencies.put( importedOnt, importees ); } importees.add( ontology ); } } return axiomCount; }
private void resetRootImports() { Set<OWLOntology> onts = getOntologies(); onts.remove(rootOntology); final Set<OWLOntology> newRoots = OWLUtils.getImportRoots(onts); final Set<OWLOntology> oldRoots = rootOntology.getImports(); oldRoots.removeAll(newRoots); newRoots.removeAll(rootOntology.getImports()); final OWLDataFactory df = mngr.getOWLDataFactory(); List<OWLOntologyChange> changes = new ArrayList<>(); for (OWLOntology root : newRoots){ changes.add(new AddImport(rootOntology, df.getOWLImportsDeclaration(getImportIRIForOntology(root)))); } for (OWLOntology root : oldRoots){ changes.add(new RemoveImport(rootOntology, df.getOWLImportsDeclaration(getImportIRIForOntology(root)))); } mngr.applyChanges(changes); }
private void storeLabel (OWLClass c, String classUri) { Label classLabel = this.getLabel(c, this.ontology); if (StringUtils.isBlank(classLabel.text)) { Set<OWLOntology> importedOntologies = this.ontology.getImports(); for (OWLOntology ont: importedOntologies) { classLabel = this.getLabel(c, ont); if (StringUtils.isNotEmpty(classLabel.text)) { break; } } } if (StringUtils.isNotBlank(classLabel.text)) { setProperty( CLASS_NODE_LABEL, classUri, "rdfs:label", classLabel.text ); } if (StringUtils.isNoneBlank(classLabel.lang)) { setProperty( CLASS_NODE_LABEL, classUri, "labelLang", classLabel.lang ); } }
ontologies.addAll(parentOntology.getImports()); for (OWLAnnotationProperty property : properties) {
ontologies.add(ontology); if (useGraphs) { ontologies.addAll(ontology.getImports());
public void addImport(IOntology ontology) { if (!this.ontology.getImports().contains(((Ontology) ontology).ontology)) { OWLDataFactory factory = this.ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLImportsDeclaration imp = factory.getOWLImportsDeclaration(IRI .create(((Ontology) ontology).ontology.getOntologyID() .getOntologyIRI().toString())); this.ontology.getOWLOntologyManager() .applyChange(new AddImport(this.ontology, imp)); this.imported.add(ontology.getConceptSpace()); } }
Set<OWLOntology> imports = ontology.getImports(); if(!imports.isEmpty()) { LOGGER.info("Processing the imports of \"" + entry.getOntologyShortName() + "\" ...");