Refine search
public static void addDependend(Collection<BlankNodeOrIRI> collection, Graph executionPlan, BlankNodeOrIRI executionNode){ for(Iterator<Triple> it = executionPlan.filter(executionNode, DEPENDS_ON, null); it.hasNext();collection.add((BlankNodeOrIRI)it.next().getObject())); } public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) {
private Set<IRI> getIfps(Graph tBox) { final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type, OWL.InverseFunctionalProperty); final Set<IRI> ifps = new HashSet<IRI>(); while (ifpDefinitions.hasNext()) { final Triple triple = ifpDefinitions.next(); ifps.add((IRI) triple.getSubject()); } return ifps; }
private Set<IRI> getIfps(Graph tBox) { final Iterator<Triple> ifpDefinitions = tBox.filter(null, RDF.type, OWL.InverseFunctionalProperty); final Set<IRI> ifps = new HashSet<IRI>(); while (ifpDefinitions.hasNext()) { final Triple triple = ifpDefinitions.next(); ifps.add((IRI) triple.getSubject()); } return ifps; }
private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) { try { Triple t = permissionMGraph.filter(list, rest, null).next(); RDFTerm restList = t.getObject(); removeList((BlankNodeOrIRI) restList, permissionMGraph); permissionMGraph.remove(t); Iterator<Triple> iter = permissionMGraph.filter(list, first, null); iter.next(); iter.remove(); } catch (NoSuchElementException e) { //if it has no rest its rdf:NIL and has no first } }
/** if value id an rdf:list in tc, initialize list * @param tc */ private void doListInitialization(Graph tc) { if (value instanceof BlankNodeOrIRI) { if ((tc.filter((BlankNodeOrIRI) value, RDF.rest, null).hasNext()) || (tc.filter((BlankNodeOrIRI) value, OWL.sameAs, RDF_NIL).hasNext())) { list = new RdfList((BlankNodeOrIRI) value, tc); } } }
private void removeList(BlankNodeOrIRI list, Graph permissionMGraph) { try { Triple t = permissionMGraph.filter(list, rest, null).next(); RDFTerm restList = t.getObject(); removeList((BlankNodeOrIRI) restList, permissionMGraph); permissionMGraph.remove(t); Iterator<Triple> iter = permissionMGraph.filter(list, first, null); iter.next(); iter.remove(); } catch (NoSuchElementException e) { //if it has no rest its rdf:NIL and has no first } }
private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) { if (list.equals(rdfNil)) { return; } Triple restTriple = permissionMGraph.filter(list, rest, null).next(); BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject(); readList(restList, permissionMGraph, target); Triple firstTriple = permissionMGraph.filter(list, first, null).next(); Literal firstValue = (Literal) firstTriple.getObject(); String value = LiteralFactory.getInstance().createObject(String.class, firstValue); target.addFirst(value); }
public static void addDependend(Collection<BlankNodeOrIRI> collection, Graph executionPlan, BlankNodeOrIRI executionNode){ for(Iterator<Triple> it = executionPlan.filter(executionNode, DEPENDS_ON, null); it.hasNext();collection.add((BlankNodeOrIRI)it.next().getObject())); } public static boolean isOptional(Graph executionPlan, BlankNodeOrIRI executionNode) {
private void readList(BlankNodeOrIRI list, Graph permissionMGraph, LinkedList<String> target) { if (list.equals(rdfNil)) { return; } Triple restTriple = permissionMGraph.filter(list, rest, null).next(); BlankNodeOrIRI restList = (BlankNodeOrIRI) restTriple.getObject(); readList(restList, permissionMGraph, target); Triple firstTriple = permissionMGraph.filter(list, first, null).next(); Literal firstValue = (Literal) firstTriple.getObject(); String value = LiteralFactory.getInstance().createObject(String.class, firstValue); target.addFirst(value); }
/** * Getter for the ChainExecution used to enhance the content item * @param em the graph with the execution metadata * @param ciUri the ID of the content item * @return the node that {@link ExecutionMetadata#ENHANCES} the {@link ContentItem} */ public static BlankNodeOrIRI getChainExecution(Graph em, IRI ciUri){ Iterator<Triple> it = em.filter(null, ENHANCES, ciUri); if(it.hasNext()){ return it.next().getSubject(); } else { return null; } } /**
/** * Checks whether the given graph name already exists as the specified resource (either graph or mgraph). * @param graphName the graph name * @param graphType the resource type * @return true if a resource with the given name and type already exists, false otherwise. */ private boolean isExistingGraphName(IRI graphName, IRI graphType) { return graphNameIndex.getGraph().filter(graphName, RDF.type, graphType).hasNext(); }