public static String reasoningSpec(String repoSpec, String reasoner, Resource inferredGraph) { String reasoningSpec = repoSpec + "[" + reasoner; if (inferredGraph != null) { reasoningSpec += ("#<" + inferredGraph.stringValue() + ">"); } return reasoningSpec + "]"; }
@Override public String toString() { return "<" + val.stringValue() + ">"; }
@Override public String toString() { return "SpinConstructRule{" + ruleId.stringValue() + "}"; }
@Override public int compareTo(ResourceWritable other) { return val.stringValue().compareTo(other.val.stringValue()); }
@Override public int hashCode() { return val != null ? val.stringValue().hashCode() : 0; }
@Override public void handle(Model model, Resource resource, Object instance) { set.accept(instance, resource.stringValue()); }
@Override public void handle(Model model, Resource resource, Object instance) { set.accept(instance, resource.stringValue()); }
private String getResourceValue(Resource subject) { if (subject == null) { return null; } else if (subject instanceof IRI) { return subject.stringValue(); } else if (subject instanceof BNode) { return "_:" + subject.stringValue(); } throw new IllegalStateException("Did not recognise resource type: " + subject.getClass().getName()); }
private String getResourceValue(Resource subject) { if (subject == null) { return null; } else if (subject instanceof IRI) { return subject.stringValue(); } else if (subject instanceof BNode) { return "_:" + subject.stringValue(); } throw new IllegalStateException("Did not recognise resource type: " + subject.getClass().getName()); }
@Override public boolean equals(Object o) { if (this == o) { return true; } else if (o == null || this.getClass() != o.getClass()) { return false; } ResourceWritable other = (ResourceWritable) o; if (this.val == null) { return other.val == null; } else if (other.val == null) { return false; } else if (this.val.stringValue() == null) { return other.val.stringValue() == null; } else { return this.val.stringValue().equals(other.val.stringValue()); } }
public void receiveTriple(Resource s, IRI p, Value o, IRI g, ExtractionContext context) throws TripleHandlerException { if(!this.resources.contains(s)) { this.resources.add(s); this.printStream.println(s.stringValue()); } if(o instanceof Resource && !this.resources.contains(o)) { this.resources.add((Resource) o); this.printStream.println(o.stringValue()); } }
private boolean matchingGraphContext(Resource subject) { return graphContext == null || subject.equals(graphContext) || subject.stringValue().startsWith(graphContext.stringValue() + "_subject_") || subject.stringValue().startsWith(graphContext.stringValue() + "_property_") || subject.stringValue().startsWith(graphContext.stringValue() + "_object_"); }
/** * Returns the correct syntax for a Resource, depending on whether it is a URI or a Blank Node (ie, BNode) * * @param uriOrBnode * The resource to serialise to a string * @return The string value of the sesame resource */ public static String resourceToString(final Resource uriOrBnode) { if (uriOrBnode instanceof IRI) { return uriOrBnode.stringValue(); } else { return "_:" + ((BNode)uriOrBnode).getID(); } }
/** * Returns the correct syntax for a Resource, depending on whether it is a URI or a Blank Node (ie, BNode) * * @param uriOrBnode * The resource to serialise to a string * @return The string value of the sesame resource */ public static String resourceToString(final Resource uriOrBnode) { if (uriOrBnode instanceof IRI) { return uriOrBnode.stringValue(); } else { return "_:" + ((BNode)uriOrBnode).getID(); } }
private String createDeleteDataCommand(Iterable<? extends Statement> statements, Resource... contexts) { StringBuilder qb = new StringBuilder(); qb.append("DELETE DATA \n"); qb.append("{ \n"); if (contexts.length > 0) { for (Resource context : contexts) { if (context != null) { String namedGraph = context.stringValue(); if (context instanceof BNode) { // SPARQL does not allow blank nodes as named graph // identifiers, so we need to skolemize // the blank node id. namedGraph = "urn:nodeid:" + context.stringValue(); } qb.append(" GRAPH <" + namedGraph + "> { \n"); } createDataBody(qb, statements, true); if (context != null) { qb.append(" } \n"); } } } else { createDataBody(qb, statements, false); } qb.append("}"); return qb.toString(); }
private String createDeletePatternCommand(Resource subject, IRI predicate, Value object, Resource[] contexts) { StringBuilder qb = new StringBuilder(); qb.append("DELETE WHERE \n"); qb.append("{ \n"); if (contexts.length > 0) { for (Resource context : contexts) { if (context != null) { String namedGraph = context.stringValue(); if (context instanceof BNode) { // SPARQL does not allow blank nodes as named graph // identifiers, so we need to skolemize // the blank node id. namedGraph = "urn:nodeid:" + context.stringValue(); } qb.append(" GRAPH <" + namedGraph + "> { \n"); } createBGP(qb, subject, predicate, object); if (context != null && context instanceof IRI) { qb.append(" } \n"); } } } else { createBGP(qb, subject, predicate, object); } qb.append("}"); return qb.toString(); }
public static String filteredSpec(AGAbstractRepository repo, Resource[] contexts) { String[] graphs = new String[contexts.length]; for (int i = 0; i < contexts.length; i++) { if (null == contexts[i]) { graphs[i] = null; } else { graphs[i] = "<" + contexts[i].stringValue() + ">"; } } return filteredSpec(repo.getSpec(), graphs); }
@Override public Node call() { //throws AnyException return graphdb.findNode(RESOURCE, "uri", st.getSubject().stringValue()); } });
public void endRDF() throws RDFHandlerException { for(String uri:resourceLabels.keySet()){ vNodes.put(uri,new VirtualNode(Util.labels(new ArrayList<>(resourceLabels.get(uri))), resourceProps.get(uri), graphdb)); } statements.forEach(st -> vRels.add( new VirtualRelationship(vNodes.get(st.getSubject().stringValue().replace("'", "\'")), vNodes.get(st.getObject().stringValue().replace("'", "\'")), RelationshipType.withName(shorten(st.getPredicate()))))); }
/** * Returns the application Resource for a given stored resource. * <p> * This method is intended for use within the AG client library, * not for use by applications. * </p> * * @param stored a stored resource * @param vf a value factory that can create new store values * @return the application resource * @see #getStorableResource(Resource, AGValueFactory) * @since v4.4 */ public static Resource getApplicationResource(Resource stored, AGValueFactory vf) { Resource app = stored; if (stored instanceof IRI && vf.isURIForExternalBlankNode(stored)) { app = vf.createBNode(stored.stringValue().substring(vf.PREFIX_FOR_EXTERNAL_BNODES.length())); } return app; }