@Override public boolean equals(Object other) { if(other instanceof Create) { Create o = (Create)other; return silent == o.silent && nullEquals(graph, o.graph); } return false; }
@Override public void meet(Create node) throws RDFHandlerException { if (node.isSilent()) { handler.handleStatement( valueFactory.createStatement(subject, SP.SILENT_PROPERTY, BooleanLiteral.TRUE)); } if (node.getGraph() != null) { handler.handleStatement(valueFactory.createStatement(subject, SP.GRAPH_IRI_PROPERTY, node.getGraph().getValue())); } }
@Override public void meet(Create node) throws RuntimeException { list.add(new StatementPattern(newVar(), newVar(), newVar(), newVar(node.getGraph()))); }
public Create(ValueConstant graph) { super(); setGraph(graph); }
public void visitCreate(Resource query) throws OpenRDFException { Value graph = Statements.singleValue(query, SP.GRAPH_IRI_PROPERTY, store); Create create = new Create(new ValueConstant(graph)); boolean isSilent = Statements.booleanValue(query, SP.SILENT_PROPERTY, store); create.setSilent(isSilent); updateRoot = create; }
protected void executeCreate(Create create, UpdateContext uc) throws SailException { // check if named graph exists, if so, we have to return an error. // Otherwise, we simply do nothing. Value graphValue = create.getGraph().getValue(); if (graphValue instanceof Resource) { Resource namedGraph = (Resource)graphValue; CloseableIteration<? extends Resource, SailException> contextIDs = con.getContextIDs(); try { while (contextIDs.hasNext()) { Resource contextID = contextIDs.next(); if (namedGraph.equals(contextID)) { throw new SailException("Named graph " + namedGraph + " already exists. "); } } } finally { contextIDs.close(); } } }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (graph == current) { setGraph((ValueConstant)replacement); } else { super.replaceChildNode(current, replacement); } }