public void reportReception(Node eventId) { synchronized (this.times) { this.times.put(eventId.getURI(), System.currentTimeMillis()); } }
public static NodeValue makeNode(String lexicalForm, String langTag, Node datatype) { String uri = (datatype==null) ? null : datatype.getURI() ; return makeNode(lexicalForm, langTag, uri) ; }
@Override public Iterator<String> listNames() { ArrayList<String> nameList = new ArrayList<String>(); Iterator<Node> nodeIt = g.listGraphNodes(); while (nodeIt.hasNext()) { Node n = nodeIt.next(); nameList.add(n.getURI()); } return nameList.iterator(); }
public Node convert(Node node) { if ( ! node.isURI() ) return node ; String iri = node.getURI() ; return null ; } }
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; }
public static Procedure build(Node procId, PropFuncArg subjArg, PropFuncArg objArg, ExecutionContext execCxt) { Context context = execCxt.getContext() ; PropertyFunctionRegistry reg = choosePropFuncRegistry(context) ; PropertyFunctionFactory f = reg.get(procId.getURI()) ; PropertyFunction pf = f.create(procId.getURI()) ; pf.build(subjArg, procId, objArg, execCxt) ; //Make wrapper return new ProcedurePF(pf, subjArg, procId, objArg) ; }
/** compact call to ReasonerRegistry.makeDirect */ private static final Property makeDirect( Property type ) { return ResourceFactory.createProperty( ReasonerRegistry.makeDirect( type.asNode().getURI() ) ); }
public static Procedure build(Node procId, ExprList args, ExecutionContext execCxt) { Context context = execCxt.getContext() ; ProcedureRegistry reg = chooseProcedureRegistry(context) ; ProcedureFactory f = reg.get(procId.getURI()) ; Procedure proc = f.create(procId.getURI()) ; args.prepareExprs(context) ; // Allow args to build as well. proc.build(procId, args, execCxt) ; return proc ; }
@Override public void build(PropFuncArg argSubject, Node predicate, PropFuncArg argObject, ExecutionContext execCxt) { super.build(argSubject, predicate, argObject, execCxt) ; if ( argObject.isList() && argObject.getArgList().size() != 0 ) throw new QueryBuildException("List arguments (object) to "+predicate.getURI()) ; }
public static Procedure build(Node procId, PropFuncArg subjArg, PropFuncArg objArg, ExecutionContext execCxt) { Context context = execCxt.getContext() ; PropertyFunctionRegistry reg = choosePropFuncRegistry(context) ; PropertyFunctionFactory f = reg.get(procId.getURI()) ; PropertyFunction pf = f.create(procId.getURI()) ; pf.build(subjArg, procId, objArg, execCxt) ; //Make wrapper return new ProcedurePF(pf, subjArg, procId, objArg) ; }
@Override public List<Map<String, Collection<Object>>> apply(final RdfStream stream) { final LDPath<RDFNode> ldpathForResource = getLdpathResource(stream); final Resource context = createResource(stream.topic().getURI()); try { return ImmutableList.of(unsafeCast( ldpathForResource.programQuery(context, new InputStreamReader(query)))); } catch (final LDPathParseException e) { throw new RepositoryRuntimeException(e); } }
public final boolean checkURI(Node node, long line, long col) { if ( cache != null && cache.containsKey(node) ) return true ; IRI iri = iriFactory.create(node.getURI()); // always works - no exceptions. boolean b = checkIRI(iri, line, col) ; // If OK, put in cache. if ( cache != null && b ) cache.put(node, iri) ; return b ; }
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) ; }
public IndexEphemeralSubscriptionRequest(Node graph, SubscriptionId subscriptionId, String subscriberUrl) { super(new QuadruplePattern( Quadruple.removeMetaInformation(graph), Node.ANY, Node.ANY, Node.ANY, true), null); this.metaGraph = SerializedValue.create(graph.getURI()); this.subscriptionId = SerializedValue.create(subscriptionId); this.subscriberUrl = SerializedValue.create(subscriberUrl); }
@Override public NodeValue eval(NodeValue x, NodeValue y) { if ( ! x.isString() ) throw new ExprEvalException("cast: arg 2 is not a string: "+x) ; if ( ! y.isIRI() ) throw new ExprEvalException("cast: arg 2 is not a URI: "+y) ; String lex = x.getString() ; y.asNode().getURI() ; throw new ARQNotImplemented() ; }
public static NodeValue strDatatype(NodeValue v1, NodeValue v2) { if ( ! v1.isString() ) throw new ExprEvalException("Not a string (arg 1): "+v1) ; if ( ! v2.isIRI() ) throw new ExprEvalException("Not an IRI (arg 2): "+v2) ; String lex = v1.asString() ; Node dt = v2.asNode() ; // Check? Node n = Node.createLiteral(lex, null, Node.getType(dt.getURI())) ; return NodeValue.makeNode(n) ; }
public static String str(Node node) { if ( node.isLiteral() ) return node.getLiteral().getLexicalForm() ; if ( node.isURI() ) return node.getURI() ; // if ( node.isBlank() ) return node.getBlankNodeId().getLabelString() ; // if ( node.isBlank() ) return "" ; if ( node.isBlank() ) NodeValue.raise(new ExprTypeException("Blank node: "+node)) ; NodeValue.raise(new ExprEvalException("Not a string: "+node)) ; return "[undef]" ; }