Package org.apache.stanbol.ontologymanager.servicesapi.scope

Examples of org.apache.stanbol.ontologymanager.servicesapi.scope.ScopeManager


        /*
         * We have to do it like this because we cannot make this class a Component and reference ONManager
         * and SessionManager, otherwise an activation cycle will occur.
         */
        ScopeManager scopeManager = ScopeManagerImpl.get(); // FIXME get rid of this.
        SessionManager sessionManager = SessionManagerImpl.get();
        String prefix_scope = _NS_STANBOL_INTERNAL + Scope.shortName + "/", prefix_session = _NS_STANBOL_INTERNAL
                                                                                             + Session.shortName
                                                                                             + "/";

        // TODO check when not explicitly typed.
        SpaceType spaceType;
        if (meta.contains(new TripleImpl(candidate, RDF.type, SPACE_URIREF))) {
            Resource rScope;
            Iterator<Triple> parentSeeker = meta.filter(candidate, IS_SPACE_CORE_OF_URIREF, null);
            if (parentSeeker.hasNext()) {
                rScope = parentSeeker.next().getObject();
                spaceType = SpaceType.CORE;
            } else {
                parentSeeker = meta.filter(candidate, IS_SPACE_CUSTOM_OF_URIREF, null);
                if (parentSeeker.hasNext()) {
                    rScope = parentSeeker.next().getObject();
                    spaceType = SpaceType.CUSTOM;
                } else {
                    parentSeeker = meta.filter(null, HAS_SPACE_CORE_URIREF, candidate);
                    if (parentSeeker.hasNext()) {
                        rScope = parentSeeker.next().getSubject();
                        spaceType = SpaceType.CORE;
                    } else {
                        parentSeeker = meta.filter(null, HAS_SPACE_CUSTOM_URIREF, candidate);
                        if (parentSeeker.hasNext()) {
                            rScope = parentSeeker.next().getSubject();
                            spaceType = SpaceType.CUSTOM;
                        } else throw new InvalidMetaGraphStateException("Ontology space " + candidate
                                                                        + " does not declare a parent scope.");
                    }
                }
            }
            if (!(rScope instanceof UriRef)) throw new InvalidMetaGraphStateException(
                    rScope + " is not a legal scope identifier.");
            String scopeId = ((UriRef) rScope).getUnicodeString().substring(prefix_scope.length());
            Scope scope = scopeManager.getScope(scopeId);
            switch (spaceType) {
                case CORE:
                    handles.add(scope.getCoreSpace());
                    break;
                case CUSTOM:
View Full Code Here


        OWLOntology o = super.exportToOWLOntology(merge, universalPrefix);

        IRI iri = o.getOntologyID().getOntologyIRI();

        if (merge) { // Re-merge
            ScopeManager onm = ScopeManagerImpl.get(); // FIXME try to avoid this.
            final Set<OWLOntology> set = new HashSet<OWLOntology>();
            set.add(o);
            for (String scopeID : attachedScopes) {
                log.debug(" ... Merging with attached scope {}.", scopeID);

                Scope sc = onm.getScope(scopeID);
                if (sc != null)

                set.add(sc.export(OWLOntology.class, merge));

                for (OWLOntologyID ontologyId : managedOntologies) {
View Full Code Here

TOP

Related Classes of org.apache.stanbol.ontologymanager.servicesapi.scope.ScopeManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.