public static boolean hasDatasetDescription(UpdateWithUsing update) { boolean result = update.getUsing() != null && !update.getUsing().isEmpty(); result = result || update.getUsingNamed() != null && !update.getUsingNamed().isEmpty(); return result; }
public static void applyWithIriIfApplicable(Update update, Node withIri) { if(update instanceof UpdateWithUsing) { UpdateWithUsing x = (UpdateWithUsing)update; boolean hasWithIri = x.getWithIRI() != null; if(!hasWithIri) { x.setWithIRI(withIri); } } }
@Override public void send(Update update) { // ---- check USING/USING NAMED/WITH not used. // ---- update request to have USING/USING NAMED if ( null != usingList && usingList.usingIsPresent() ) { if ( update instanceof UpdateWithUsing ) { UpdateWithUsing upu = (UpdateWithUsing)update ; if ( upu.getUsing().size() != 0 || upu.getUsingNamed().size() != 0 || upu.getWithIRI() != null ) throw new UpdateException("SPARQL Update: Protocol using-graph-uri or using-named-graph-uri present where update request has USING, USING NAMED or WITH") ; for ( Node node : usingList.getUsing() ) upu.addUsing(node) ; for ( Node node : usingList.getUsingNamed() ) upu.addUsingNamed(node) ; } } sink.send(update); }
final public void UsingClause(UpdateWithUsing update) throws ParseException { String iri ; Node n ; jj_consume_token(USING); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: iri = iri(); n = createNode(iri) ; update.addUsing(n) ; break; case NAMED: jj_consume_token(NAMED); iri = iri(); n = createNode(iri) ; update.addUsingNamed(n) ; break; default: jj_la1[52] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }
public static String getWithIri(Update update) { Node with = update instanceof UpdateWithUsing ? ((UpdateWithUsing)update).getWithIRI() : null; String result = with == null ? null : with.toString(); return result; }
public static void applyDatasetDescription(UpdateWithUsing update, DatasetDescription dg) { if(dg != null) { List<String> dgus = dg.getDefaultGraphURIs(); if(dgus != null) { for(String dgu : dgus) { Node node = NodeFactory.createURI(dgu); update.addUsing(node); } } List<String> ngus = dg.getDefaultGraphURIs(); if(ngus != null) { for(String ngu : ngus) { Node node = NodeFactory.createURI(ngu); update.addUsing(node); } } } } }
final public void UsingClause(UpdateWithUsing update) throws ParseException { String iri ; Node n ; jj_consume_token(USING); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: iri = iri(); n = createNode(iri) ; update.addUsing(n) ; break; case NAMED: jj_consume_token(NAMED); iri = iri(); n = createNode(iri) ; update.addUsingNamed(n) ; break; default: jj_la1[56] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }