/** An enhanced node is Anon[ymous] iff its underlying node is Blank. */ public final boolean isAnon() { return node.isBlank(); }
private static int hashNode(Node node) { if ( node.isBlank() ) return 59 ; return node.hashCode() ; }
@Override public boolean canWrap( Node node, EnhGraph eg ) { // node will support being an OntResource facet if it is a uri or bnode return node.isURI() || node.isBlank(); } };
public boolean isBlank() { if ( node == null ) return false ; forceToNode() ; return node.isBlank() ; }
public String asString(Node n) { if ( ! n.isBlank() ) return null ; return mapNode(n) ; }
public String asString(Node n) { if ( ! n.isBlank() ) return null ; return mapNode(n) ; }
public boolean isBlank() { if ( node == null ) return false ; forceToNode() ; return node.isBlank() ; }
public static String sparqlNodeDelete(Node node, String varName) { if (node.isBlank()) { return "?" + node.getBlankNodeLabel().replaceAll("\\W", ""); } else { return sparqlNode(node, varName); } }
@Override public String asString(Node n) { // Map blank nodes and non-distinguished variables. if ( ! n.isBlank() && !Var.isBlankNodeVar(n) ) return null ; return mapNode(n) ; } }
@Override public String asString(Node n) { // Map blank nodes and non-distingusihed variables. if ( ! n.isBlank() && !Var.isBlankNodeVar(n) ) return null ; return mapNode(n) ; } }
@Override public EnhNode wrap(Node n,EnhGraph eg) { if ( n.isURI() || n.isBlank() ) return new ResourceImpl(n,eg); if ( n.isLiteral() ) return new LiteralImpl(n,eg); return null; } };
@Override public boolean doCheck( Node n, EnhGraph g ) { return n.isBlank() && g.asGraph().contains( n, RDF.type.asNode(), OWL.DataRange.asNode() ); } }
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 void output(Writer w, Node n, NodeToLabelMap bnodes) 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 = bnodes.asString(n) ; str = csvSafe(str) ; w.write(str) ; }
@Override public NodeValue exec(NodeValue v) { Node n = v.asNode() ; if ( ! n.isBlank() ) throw new ExprEvalException("bnode: not a blank node") ; NodeValue nv = NodeValue.makeString(n.getBlankNodeId().getLabelString()) ; return nv ; } }
protected String resource(Node rsrc) { if (rsrc.isBlank()) { return "http://marklogic.com/semantics/blank/" + Long.toHexString( fuse(scramble((long)rsrc.hashCode()),fuse(scramble(milliSecs),randomValue))); } else { return escapeXml(rsrc.toString()); } }
private void checkQuad(Node graph, Node subject, Node predicate, Node object, long line, long col) { if ( graph != null && ! graph.isURI() && ! graph.isBlank() ) // Allow blank nodes - syntax may restrict more. { errorHandler.error("Graph name is not a URI or blank node: "+FmtUtils.stringForNode(graph), line, col) ; throw new RiotException("Bad graph name: "+graph) ; } checkTriple(subject,predicate,object,line,col) ; }
@Override public NodeValue exec(NodeValue v) { Node n = v.asNode() ; if ( ! n.isBlank() ) throw new ExprEvalException("bnode: not a blank node") ; NodeValue nv = NodeValue.makeString(n.getBlankNodeId().getLabelString()) ; return nv ; } }
protected static Expr buildFunctionCall(ItemList list) { Item head = list.get(0) ; Node node = head.getNode() ; if ( node.isBlank() ) BuilderLib.broken(head, "Blank node for function call!") ; if ( node.isLiteral() ) BuilderLib.broken(head, "Literal node for function call!") ; ExprList args = buildExprListUntagged(list, 1) ; // Args return new E_Function(node.getURI(), args) ; }
private boolean isBnodeTypeQuery(Triple t) { return t.getSubject().isBlank() && t.getPredicate().equals( RDF.type.asNode() ) && (BuiltinTerm.find( t.getObject() ) == null || t.getObject().equals( OWL.Thing.asNode() ) || t.getObject().equals( OWL.Nothing.asNode() )); }