@Override protected String labelForBlank(Node node) { // Needs to be safe? //String str = NodeFmtLib.safeBNodeLabel(node.getBlankNodeLabel()) ; String str = node.getBlankNodeLabel() ; return "<_:"+str+">" ; } } ;
@Override protected String labelForBlank(Node node) { // NodeFmtLib.safeBNodeLabel adds a "B" // This may not be a legal label if it starts with a number, say. return "_:"+node.getBlankNodeLabel() ; } }
@Override protected String labelForBlank(Node node) { return "_:"+node.getBlankNodeLabel() ; } }
@Override protected String labelForBlank(Node node) { // Needs to be safe? //String str = NodeFmtLib.safeBNodeLabel(node.getBlankNodeLabel()) ; String str = node.getBlankNodeLabel() ; return "<_:"+str+">" ; } } ;
/** * Returns a {@link String} representation of the given blank node. * * @param blankNode the blank node. * @return a {@link String} representation of the given blank node. */ public static String asNtBlankNode(final Node blankNode) { return new StringBuilder("_:") .append(blankNode.getBlankNodeLabel()) .toString(); }
public boolean checkBlank(Node node, long line, long col) { String x = node.getBlankNodeLabel() ; if ( x.indexOf(' ') >= 0 ) { handler.error("Illegal blank node label (contains a space): "+node, line, col) ; return false ; } return true ; } }
public boolean checkBlank(Node node, long line, long col) { String x = node.getBlankNodeLabel() ; if ( x.indexOf(' ') >= 0 ) { handler.error("Illegal blank node label (contains a space): "+node, line, col) ; return false ; } return true ; } }
@Override protected String labelForBlank(Node node) { // NodeFmtLib.safeBNodeLabel adds a "B" return "_:"+NodeFmtLib.encodeBNodeLabel(node.getBlankNodeLabel()) ; } }
protected String labelForBlank(Node node) { return "_:"+NodeFmtLib.safeBNodeLabel(node.getBlankNodeLabel()) ; }
@Override public String getInternalID() { return ((Node)this.getUnderlyingBlankNode()).getBlankNodeLabel(); }
@Override public void formatBNode(AWriter w, Node n) { formatBNode(w, n.getBlankNodeLabel()) ; }
public static String sparqlNodeDelete(Node node, String varName) { if (node.isBlank()) { return "?" + node.getBlankNodeLabel().replaceAll("\\W", ""); } else { return sparqlNode(node, varName); } }
public static String sparqlNodeUpdate(Node node, String varName) { if (node.isBlank()) { return "_:" + node.getBlankNodeLabel().replaceAll("\\W", ""); } else { return sparqlNode(node, varName); } }
private void output(Writer w, Node n) throws IOException { //String str = FmtUtils.stringForNode(n) ; String str = "?" ; if ( n.isLiteral() ) str = n.getLiteralLexicalForm() ; else if ( n.isURI() ) str = n.getURI() ; else if ( n.isBlank() ) str = n.getBlankNodeLabel() ; str = csvSafe(str) ; w.write(str) ; }
private static String toString(RDFNode v) { if( v.isLiteral() ) return ((Literal) v).getLexicalForm(); else if( v.isAnon() ) return ANON_URI + v.asNode().getBlankNodeLabel(); else return ((Resource) v).getURI(); }
private static String toString(RDFNode v) { if( v.isLiteral() ) { return ((Literal) v).getLexicalForm(); } else if( v.isAnon() ) { return ANON_URI + v.asNode().getBlankNodeLabel(); } else { return ((Resource) v).getURI(); } }
/** * Return the appropriate lexical form of a node */ protected String lex(Node n, RuleContext context) { if (n.isBlank()) { return n.getBlankNodeLabel(); } else if (n.isURI()) { return n.getURI(); } else if (n.isLiteral()) { return n.getLiteralLexicalForm(); } else { throw new BuiltinException(this, context, "Illegal node type: " + n); } }
@Override public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt) { if ( Var.isVar(subject) ) throw new ExprEvalException("bnode: subject is an unbound variable") ; if ( ! subject.isBlank() ) return IterLib.noResults(execCxt) ; String str = subject.getBlankNodeLabel() ; Node obj = NodeFactory.createLiteral(str) ; if ( Var.isVar(object) ) return IterLib.oneResult(binding, Var.alloc(object), obj, execCxt) ; // Subject and object are concrete if ( object.sameValueAs(obj) ) return IterLib.result(binding, execCxt) ; return IterLib.noResults(execCxt) ; } }
@Override public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt) { if ( Var.isVar(subject) ) throw new ExprEvalException("bnode: subject is an unbound variable") ; if ( ! subject.isBlank() ) return IterLib.noResults(execCxt) ; String str = subject.getBlankNodeLabel() ; Node obj = Node.createLiteral(str) ; if ( Var.isVar(object) ) return IterLib.oneResult(binding, Var.alloc(object), obj, execCxt) ; // Subject and object are concrete if ( object.sameValueAs(obj) ) return IterLib.result(binding, execCxt) ; return IterLib.noResults(execCxt) ; } }
return "_:"+n.getBlankNodeLabel() ;