public static boolean isIRI(Node node) { if ( node.isURI() ) return true ; return false ; }
public static boolean isIRI(Node node) { if ( node.isURI() ) return true ; return false ; }
public Node convert(Node node) { if ( ! node.isURI() ) return node ; String iri = node.getURI() ; return null ; } }
@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(); } };
/** * Helper method which does the validation of the parameters * * @param n * Node */ protected void validateParameterValue(Node n) { if (n.isURI()) { if (n.getURI().contains(">")) throw new ARQException("Value for the parameter contains a SPARQL injection risk"); } }
public ElementService(Node n, Element el, boolean silent) { if ( ! n.isURI() && ! n.isVariable() ) Log.fatal(this, "Must be a URI (or variable which will be bound) for a service endpoint") ; this.serviceNode = n ; this.element = el ; this.silent = silent ; }
private static MetaGraph parse(Node graph) { if (graph.isURI()) { String uri = graph.getURI(); return parse(uri); } // return null and do not thrown an exception because this method may be // invoked during the deserialization of a QuadruplePattern. In such a // case the graph may not be an URI and the null value is useful on high // level to detect that no meta information has been parsed return null; }
private void checkQuad(Node graph, Node subject, Node predicate, Node object, long line, long col) { if ( graph != null && ! graph.isURI() ) { errorHandler.error("Graph name is not a URI", line, col) ; throw new RiotException("Bad graph name: "+graph) ; } checkTriple(subject,predicate,object,line,col) ; }
@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; } };
private static boolean isMagicProperty(PropertyFunctionRegistry registry, Triple pfTriple) { if ( ! pfTriple.getPredicate().isURI() ) return false ; if ( registry.manages(pfTriple.getPredicate().getURI()) ) return true ; return false ; }
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.isURI() ) throw new ExprEvalException("Not a URI: "+FmtUtils.stringForNode(n)) ; String str = n.getLocalName() ; return NodeValue.makeString(str) ; } }
@Override public NodeValue exec(NodeValue v) { Node n = v.asNode() ; if ( ! n.isURI() ) throw new ExprEvalException("Not a URI: "+FmtUtils.stringForNode(n)) ; String str = n.getLocalName() ; return NodeValue.makeString(str) ; } }
@Override public NodeValue exec(NodeValue v) { Node n = v.asNode() ; if ( ! n.isURI() ) throw new ExprEvalException("Not a URI: "+FmtUtils.stringForNode(n)) ; String str = n.getNameSpace() ; return NodeValue.makeString(str) ; } }
@Override public Op make(ItemList list) { // (proc <foo> (args) form) BuilderLib.checkLength(4, list, "proc") ; Node procId = BuilderNode.buildNode(list.get(1)) ; if ( ! procId.isURI() ) BuilderLib.broken(list, "Procedure name must be a URI") ; ExprList args = BuilderExpr.buildExprOrExprList(list.get(2)) ; Op sub = build(list, 3) ; return new OpProcedure(procId, args, sub) ; }
public Op make(ItemList list) { // (proc <foo> (args) form) BuilderLib.checkLength(4, list, "proc") ; Node procId = BuilderNode.buildNode(list.get(1)) ; if ( ! procId.isURI() ) BuilderLib.broken(list, "Procedure name must be a URI") ; ExprList args = BuilderExpr.buildExprOrExprList(list.get(2)) ; Op sub = build(list, 3) ; return new OpProcedure(procId, args, sub) ; }
public boolean check(Node node, long line, long col) { // NodeVisitor? if ( node.isURI() ) return checkIRI(node, line, col) ; else if ( node.isBlank() ) return checkBlank(node, line, col) ; else if ( node.isLiteral() ) return checkLiteral(node, line, col) ; else if ( node.isVariable() ) return checkVar(node, line, col) ; handler.warning("Not a recognized node: ", line, col) ; return false ; }
@Override public final String alloc(Node scope, Node node) { if ( node.isURI() ) return labelForURI(node) ; if ( node.isLiteral() ) return labelForLiteral(node) ; if ( node.isBlank() ) return labelForBlank(node) ; if ( node.isVariable() ) return labelForVar(node) ; throw new InternalErrorException("Node type not supported: "+node) ; }
private Path build(Item item) { if (item.isNode() ) { if ( item.getNode().isURI() ) return new P_Link(item.getNode()) ; BuilderLib.broken(item, "Attempt to build path from a plain node") ; } if (item.isSymbol() ) BuilderLib.broken(item, "Attempt to build path from a bare symbol") ; return build(item.getList()) ; }
private Path build(Item item) { if (item.isNode() ) { if ( item.getNode().isURI() ) return new P_Link(item.getNode()) ; BuilderLib.broken(item, "Attempt to build path from a plain node") ; } if (item.isSymbol() ) BuilderLib.broken(item, "Attempt to build path from a bare symbol") ; return build(item.getList()) ; }