Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.TripleCollection.filter()


            }
        }

        // Sessions next
        Map<String,Collection<OWLOntologyID>> sessionOntologies = new HashMap<String,Collection<OWLOntologyID>>();
        for (Iterator<Triple> it = meta.filter(null, RDF.type, SESSION_URIREF); it.hasNext();) { // for each
                                                                                                 // scope
            Triple ta = it.next();
            NonLiteral sub = ta.getSubject();
            if (sub instanceof UriRef) {
                UriRef ses_ur = (UriRef) sub;
View Full Code Here


                    log.info("Rebuilding session \"{}\".", sessionId);
                    sessionOntologies.put(sessionId, new TreeSet<OWLOntologyID>());
                    attachedScopes.put(sessionId, new TreeSet<String>());
                    // retrieve the ontologies
                    if (ses_ur != null) {
                        for (Iterator<Triple> it2 = meta.filter(ses_ur, MANAGES_URIREF, null); it2.hasNext();) {
                            Resource obj = it2.next().getObject();
                            if (obj instanceof UriRef) sessionOntologies.get(sessionId).add(
                                keymap.buildPublicKey((UriRef) obj) // FIXME must be very temporary!
                                    // ((UriRef) obj).getUnicodeString()
                                    );
View Full Code Here

                                keymap.buildPublicKey((UriRef) obj) // FIXME must be very temporary!
                                    // ((UriRef) obj).getUnicodeString()
                                    );

                        }
                        for (Iterator<Triple> it2 = meta.filter(null, IS_MANAGED_BY_URIREF, ses_ur); it2
                                .hasNext();) {
                            Resource subj = it2.next().getSubject();
                            if (subj instanceof UriRef) sessionOntologies.get(sessionId).add(
                                keymap.buildPublicKey((UriRef) subj) // FIXME must be very temporary!
                                    // ((UriRef) subj).getUnicodeString()
View Full Code Here

                                keymap.buildPublicKey((UriRef) subj) // FIXME must be very temporary!
                                    // ((UriRef) subj).getUnicodeString()
                                    );

                        }
                        for (Iterator<Triple> it2 = meta.filter(null, APPENDED_TO_URIREF, ses_ur); it2
                                .hasNext();) {
                            Resource subj = it2.next().getSubject();
                            if (subj instanceof UriRef) {
                                String s1 = ((UriRef) subj).getUnicodeString();
                                String prefix1 = _NS_STANBOL_INTERNAL + Scope.shortName + "/";
View Full Code Here

                                    String scopeId = s1.substring(prefix1.length());
                                    attachedScopes.get(sessionId).add(scopeId);
                                }
                            }
                        }
                        for (Iterator<Triple> it2 = meta.filter(ses_ur, HAS_APPENDED_URIREF, null); it2
                                .hasNext();) {
                            Resource obj = it2.next().getObject();
                            if (obj instanceof UriRef) {
                                String s1 = ((UriRef) obj).getUnicodeString();
                                String prefix1 = _NS_STANBOL_INTERNAL + Scope.shortName + "/";
View Full Code Here

        target.add(publicKey);
        TripleCollection meta = getMetaGraph(TripleCollection.class);
        UriRef ont = keymap.buildResource(publicKey);
        Set<Resource> resources = new HashSet<Resource>();
        // Forwards
        for (Iterator<Triple> it = meta.filter(ont, OWL.sameAs, null); it.hasNext();)
            resources.add(it.next().getObject());
        // Backwards
        for (Iterator<Triple> it = meta.filter(null, OWL.sameAs, ont); it.hasNext();)
            resources.add(it.next().getSubject());
        for (Resource r : resources)
View Full Code Here

        Set<Resource> resources = new HashSet<Resource>();
        // Forwards
        for (Iterator<Triple> it = meta.filter(ont, OWL.sameAs, null); it.hasNext();)
            resources.add(it.next().getObject());
        // Backwards
        for (Iterator<Triple> it = meta.filter(null, OWL.sameAs, ont); it.hasNext();)
            resources.add(it.next().getSubject());
        for (Resource r : resources)
            if (r instanceof UriRef) {
                OWLOntologyID newKey = keymap.buildPublicKey((UriRef) r);
                if (!target.contains(newKey)) computeAliasClosure(newKey, target);
View Full Code Here

        Set<OWLOntologyID> loaded = new HashSet<OWLOntologyID>();
        TripleCollection graph = store.getTriples(graphName);
        UriRef ontologyId = null;

        // Get the id of this ontology.
        Iterator<Triple> itt = graph.filter(null, RDF.type, OWL.Ontology);
        if (itt.hasNext()) {
            NonLiteral nl = itt.next().getSubject();
            if (nl instanceof UriRef) ontologyId = (UriRef) nl;
        }
        List<OWLOntologyID> revImps = new Stack<OWLOntologyID>();
View Full Code Here

                    // Get the triples
                    TripleCollection imported =
                    // store.getTriples(ref);
                    getStoredOntology(getKey(ref), MGraph.class, false);
                    // For each owl:Ontology
                    Iterator<Triple> remove = imported.filter(null, RDF.type, OWL.Ontology);
                    while (remove.hasNext()) {
                        NonLiteral subj = remove.next().getSubject();
                        /*
                         * If it's not the root ontology, trash all its triples. If the root ontology is
                         * anonymous, all ontology annotations are to be trashed without distinction.
View Full Code Here

                        /*
                         * If it's not the root ontology, trash all its triples. If the root ontology is
                         * anonymous, all ontology annotations are to be trashed without distinction.
                         */
                        if (ontologyId == null || !subj.equals(ontologyId)) {
                            Iterator<Triple> it = imported.filter(subj, null, null);
                            while (it.hasNext()) {
                                Triple t = it.next();
                                exclusions.add(t);
                            }
                        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.