private Collection<DocumentationItem> getDocItems(ImmutableGraph documentations) { Iterator<Triple> docs = documentations.filter(null, DOCUMENTATION.documentation, null); Map<IRI,DocumentationItem> uri2docItemObj = new HashMap<IRI,DocumentationItem>(); while (docs.hasNext()) { Triple docc = docs.next(); IRI docItem = (IRI) docc.getObject(); Iterator<Triple> afterDocItemsIter = documentations.filter(docItem, DOCUMENTATION.after, null); Set<IRI> afterDocItems = new HashSet<IRI>(); while (afterDocItemsIter.hasNext()) { afterDocItems.add((IRI) afterDocItemsIter.next().getObject()); } DocumentationItem docItemObj = new DocumentationItem( docItem, afterDocItems, uri2docItemObj); uri2docItemObj.put(docItem, docItemObj); } return uri2docItemObj.values(); }
public Response deleteUser(ImmutableGraph inputGraph) { Iterator<Triple> userNameTriples = inputGraph.filter(null, PLATFORM.userName, null);
readLock.lock(); Iterator<Triple> changes = inputGraph.filter(null, null, Ontology.Change); .filter(changeNode, PLATFORM.userName, null).next() .getObject(); .filter(changeNode, Ontology.predicate, null).next() .getObject(); Iterator<Triple> iterator = inputGraph.filter(changeNode, Ontology.oldValue, null); .filter(changeNode, Ontology.newValue, null).next() .getObject();
@Override public int importConceptsFromGraph(ImmutableGraph graph, IRI conceptClass, IRI broaderProperty) throws ClassifierException { int importedCount = 0; Iterator<Triple> conceptIterator = graph.filter(null, org.apache.stanbol.enhancer.servicesapi.rdf.Properties.RDF_TYPE, conceptClass); while (conceptIterator.hasNext()) { Triple conceptTriple = conceptIterator.next(); if (!(conceptTriple.getSubject() instanceof IRI)) { continue; } IRI conceptUri = (IRI) conceptTriple.getSubject(); GraphNode node = new GraphNode(conceptUri, graph); List<String> broaderConcepts = new ArrayList<String>(); // TODO: use OWL property inference on sub-properties here instead of explicit // property filter Iterator<GraphNode> broaderIterator = node.getObjectNodes(broaderProperty); while (broaderIterator.hasNext()) { RDFTerm node2 = broaderIterator.next().getNode(); if (node2 instanceof IRI) { broaderConcepts.add(((IRI) node2).getUnicodeString()); } } addConcept(conceptUri.getUnicodeString(), broaderConcepts); importedCount++; } return importedCount; } }
@Override public int importConceptsFromGraph(ImmutableGraph graph, IRI conceptClass, IRI broaderProperty) throws ClassifierException { int importedCount = 0; Iterator<Triple> conceptIterator = graph.filter(null, org.apache.stanbol.enhancer.servicesapi.rdf.Properties.RDF_TYPE, conceptClass); while (conceptIterator.hasNext()) { Triple conceptTriple = conceptIterator.next(); if (!(conceptTriple.getSubject() instanceof IRI)) { continue; } IRI conceptUri = (IRI) conceptTriple.getSubject(); GraphNode node = new GraphNode(conceptUri, graph); List<String> broaderConcepts = new ArrayList<String>(); // TODO: use OWL property inference on sub-properties here instead of explicit // property filter Iterator<GraphNode> broaderIterator = node.getObjectNodes(broaderProperty); while (broaderIterator.hasNext()) { RDFTerm node2 = broaderIterator.next().getNode(); if (node2 instanceof IRI) { broaderConcepts.add(((IRI) node2).getUnicodeString()); } } addConcept(conceptUri.getUnicodeString(), broaderConcepts); importedCount++; } return importedCount; } }
custom = this.getCustomSpace().export(ImmutableGraph.class, merge); it = custom.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) ontologies.add(it.next().getSubject()); it = custom.filter(null, OWL.imports, null); while (it.hasNext()) importTargets.add(it.next().getObject()); core = this.getCoreSpace().export(ImmutableGraph.class, merge); it = core.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) ontologies.add(it.next().getSubject()); it = core.filter(null, OWL.imports, null); while (it.hasNext()) importTargets.add(it.next().getObject());
custom = this.getCustomSpace().export(ImmutableGraph.class, merge); it = custom.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) ontologies.add(it.next().getSubject()); it = custom.filter(null, OWL.imports, null); while (it.hasNext()) importTargets.add(it.next().getObject()); core = this.getCoreSpace().export(ImmutableGraph.class, merge); it = core.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) ontologies.add(it.next().getSubject()); it = core.filter(null, OWL.imports, null); while (it.hasNext()) importTargets.add(it.next().getObject());
root.addAll(g); it = g.filter(null, OWL.imports, null); while (it.hasNext()) { org.semanticweb.owlapi.model.IRI tgt; it = g.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) { BlankNodeOrIRI ontology = it.next().getSubject(); log.debug("Removing all triples related to {} from {}", ontology, iri); Iterator<Triple> it2 = g.filter(ontology, null, null); while (it2.hasNext()) root.remove(it2.next());
root.addAll(g); it = g.filter(null, OWL.imports, null); while (it.hasNext()) { org.semanticweb.owlapi.model.IRI tgt; it = g.filter(null, RDF.type, OWL.Ontology); while (it.hasNext()) { BlankNodeOrIRI ontology = it.next().getSubject(); log.debug("Removing all triples related to {} from {}", ontology, iri); Iterator<Triple> it2 = g.filter(ontology, null, null); while (it2.hasNext()) root.remove(it2.next());