protected String toString(final Literal v) { if (null == v) { return "null"; } return NTriplesUtil.toNTriplesString(v); }
protected String toString(final IRI v) { if (null == v) { return "null"; } return NTriplesUtil.toNTriplesString(v); }
protected String toString(final BNode v) { if (null == v) { return "null"; } return NTriplesUtil.toNTriplesString(v); }
/** * Creates an N-Triples string for the supplied value. */ public static String toNTriplesString(Value value) { // default to false. Users must call new method directly to remove // xsd:string return toNTriplesString(value, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
/** * Creates an N-Triples string for the supplied value. */ public static String toNTriplesString(Value value) { // default to false. Users must call new method directly to remove // xsd:string return toNTriplesString(value, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
/** * Creates an N-Triples string for the supplied literal. */ public static String toNTriplesString(Literal lit) { // default to false. Users must call new method directly to remove // xsd:string return toNTriplesString(lit, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
public static byte[] hashKey(Value v) { return v == null ? null : hashKey(NTriplesUtil.toNTriplesString(v).getBytes(UTF8)); }
/** * Creates an N-Triples string for the supplied literal. */ public static String toNTriplesString(Literal lit) { // default to false. Users must call new method directly to remove // xsd:string return toNTriplesString(lit, BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL.getDefaultValue()); }
/** * Encodes a value in a canonical serialized string format, for use in a URL query parameter. * * @param value * The value to encode, possibly <tt>null</tt>. * @return The protocol-serialized representation of the supplied value, or {@link #NULL_PARAM_VALUE} if * the supplied value was <tt>null</tt>. */ public static String encodeValue(Value value) { if (value instanceof BNode) { // SES-2129 special treatment of blank node names to avoid problems with round-tripping. return "_:" + ((BNode)value).getID(); } // for everything else we just use N-Triples serialization. return NTriplesUtil.toNTriplesString(value); }
public void registerSNANeighborMatrix(String matrix, String generator, List<IRI> group, int depth) throws RepositoryException { if (group == null || group.size() == 0) { throw new IllegalArgumentException("group must be non-empty."); } List<String> grp = new ArrayList<>(3); for (IRI node : group) { grp.add(NTriplesUtil.toNTriplesString(node)); } prepareHttpRepoClient().registerSNANeighborMatrix(matrix, generator, grp, depth); }
@Override protected void setup(Context context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); update = conf.get(TARGET) == null; threshold = conf.getLong(THRESHOLD, 1000); statsContext = ssf.createIRI(conf.get(TARGET_GRAPH, HALYARD.STATS_GRAPH_CONTEXT.stringValue())); String gc = conf.get(GRAPH_CONTEXT); if (gc != null) graphContext = ssf.createIRI(gc); statsContextHash = HalyardTableUtils.hashKey(NTriplesUtil.toNTriplesString(statsContext).getBytes(UTF8)); }
public void registerPredicateMapping(IRI predicate, IRI primitiveType) throws AGHttpException { String url = AGProtocol.getPredicateMappingLocation(getRoot()); String pred_nt = NTriplesUtil.toNTriplesString(predicate); String primtype_nt = NTriplesUtil.toNTriplesString(primitiveType); List<NameValuePair> params = new ArrayList<>(2); params.add(new NameValuePair(AGProtocol.FTI_PREDICATE_PARAM_NAME, pred_nt)); params.add(new NameValuePair(AGProtocol.ENCODED_TYPE_PARAM_NAME, primtype_nt)); post(url, null, params, null, null); }
public void registerDatatypeMapping(IRI datatype, IRI primitiveType) throws AGHttpException { String url = AGProtocol.getDatatypeMappingLocation(getRoot()); String datatype_nt = NTriplesUtil.toNTriplesString(datatype); String primtype_nt = NTriplesUtil.toNTriplesString(primitiveType); List<NameValuePair> params = new ArrayList<>(2); params.add(new NameValuePair(AGProtocol.TYPE_PARAM_NAME, datatype_nt)); params.add(new NameValuePair(AGProtocol.ENCODED_TYPE_PARAM_NAME, primtype_nt)); post(url, null, params, null, null); }
public void deletePredicateMapping(IRI predicate) throws AGHttpException { String url = AGProtocol.getPredicateMappingLocation(getRoot()); String pred_nt = NTriplesUtil.toNTriplesString(predicate); List<NameValuePair> params = new ArrayList<>(1); params.add(new NameValuePair(AGProtocol.FTI_PREDICATE_PARAM_NAME, pred_nt)); delete(url, null, params, null); }
public void deleteDatatypeMapping(IRI datatype) throws AGHttpException { String url = AGProtocol.getDatatypeMappingLocation(getRoot()); String datatype_nt = NTriplesUtil.toNTriplesString(datatype); List<NameValuePair> params = new ArrayList<>(1); params.add(new NameValuePair(AGProtocol.TYPE_PARAM_NAME, datatype_nt)); delete(url, null, params, null); }
private String encodeValueForStorageJSON(Value v) { Value storableValue = AGHttpRepoClient.getStorableValue(v, vf, getHttpRepoClientInternal().getAllowExternalBlankNodeIds()); return NTriplesUtil.toNTriplesString(storableValue); }
public RepositoryResult<Statement> getStatementsInPolygon(IRI type, IRI predicate, IRI polygon, int limit, boolean infer) throws RepositoryException { StatementCollector collector = new StatementCollector(); AGResponseHandler handler = new AGRDFHandler(prepareHttpRepoClient().getPreferredRDFFormat(), collector, getValueFactory(), prepareHttpRepoClient().getAllowExternalBlankNodeIds()); prepareHttpRepoClient().getGeoPolygon(NTriplesUtil.toNTriplesString(type), NTriplesUtil.toNTriplesString(predicate), NTriplesUtil.toNTriplesString(polygon), limit, infer, handler); return createRepositoryResult(collector.getStatements()); }
public RepositoryResult<Statement> getStatementsInCircle(IRI type, IRI predicate, float x, float y, float radius, int limit, boolean infer) throws RepositoryException { StatementCollector collector = new StatementCollector(); AGResponseHandler handler = new AGRDFHandler(prepareHttpRepoClient().getPreferredRDFFormat(), collector, getValueFactory(), prepareHttpRepoClient().getAllowExternalBlankNodeIds()); prepareHttpRepoClient().getGeoCircle(NTriplesUtil.toNTriplesString(type), NTriplesUtil.toNTriplesString(predicate), x, y, radius, limit, infer, handler); return createRepositoryResult(collector.getStatements()); }
public RepositoryResult<Statement> getGeoHaversine(IRI type, IRI predicate, float lat, float lon, float radius, String unit, int limit, boolean infer) throws RepositoryException { StatementCollector collector = new StatementCollector(); AGResponseHandler handler = new AGRDFHandler(prepareHttpRepoClient().getPreferredRDFFormat(), collector, getValueFactory(), prepareHttpRepoClient().getAllowExternalBlankNodeIds()); prepareHttpRepoClient().getGeoHaversine(NTriplesUtil.toNTriplesString(type), NTriplesUtil.toNTriplesString(predicate), lat, lon, radius, unit, limit, infer, handler); return createRepositoryResult(collector.getStatements()); }
public RepositoryResult<Statement> getStatementsInBox(IRI type, IRI predicate, float xmin, float xmax, float ymin, float ymax, int limit, boolean infer) throws RepositoryException { StatementCollector collector = new StatementCollector(); AGResponseHandler handler = new AGRDFHandler(prepareHttpRepoClient().getPreferredRDFFormat(), collector, getValueFactory(), prepareHttpRepoClient().getAllowExternalBlankNodeIds()); prepareHttpRepoClient().getGeoBox(NTriplesUtil.toNTriplesString(type), NTriplesUtil.toNTriplesString(predicate), xmin, xmax, ymin, ymax, limit, infer, handler); return createRepositoryResult(collector.getStatements()); }