public ClassMarshall(ValueFactory vf, ClassLoader cl) throws DatatypeConfigurationException { this.vf = vf; this.cl = cl; datatype = ValueFactoryImpl.getInstance().createURI(DATATYPE); }
/** * Construct an instance with a simple Sesame ValueFactoryImpl. */ public DefaultBlueprintsValueFactory(final String graphNamespace, final String vertexNamespace, final String edgeNamespace, final URI type, final URI vertex, final URI edge, final URI label) { this(new ValueFactoryImpl(), graphNamespace, vertexNamespace, edgeNamespace, type, vertex, edge, label); }
public Literal createLiteral(String value, String language, String datatype) { if (datatype != null) { URI dtURI = createURI(datatype); return createLiteral(value, dtURI); } else if (language != null) { return createLiteral(value, language); } else { return createLiteral(value); } }
final ValueFactoryImpl vf = ValueFactoryImpl.getInstance(); subject = vf.createURI(triple.getSubject().getIRI().toString()); subject = vf.createBNode(triple.getSubject().getIRI().toString().substring(2)); subject = vf.createBNode(triple.getSubject().getIRI().toString()); predicate = vf.createURI(triple.getPredicate().getIRI().toString()); object = vf.createURI(triple.getObject().getIRI().toString()); vf.createLiteral(literalObject.stringValue(), vf.createURI(literalObject.getDatatype().toString())); object = vf.createLiteral(literalObject.stringValue(), literalObject.getLang()); object = vf.createLiteral(literalObject.stringValue()); object = vf.createBNode(triple.getObject().getIRI().toString().substring(2)); object = vf.createBNode(triple.getObject().getIRI().toString()); return Collections.singletonList(vf.createStatement(subject, predicate, object)); results.add(vf.createStatement(subject, predicate, object, nextContext));
private Map<String, Value> getBindings(Map<String, Object> variables) { Map<String, Value> bindings = new HashMap<>(); for (Map.Entry<String, Object> stringObjectEntry : variables.entrySet()) { if (!stringObjectEntry.getValue().getClass().equals(Object.class)) bindings.put(stringObjectEntry.getKey(), ValueFactoryImpl.getInstance().createLiteral(stringObjectEntry.getValue().toString())); } return bindings; } }
@Override public ValueFactory getValueFactory() { // Gets a ValueFactory for this Repository. return ValueFactoryImpl.getInstance(); }
@Override public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException { Value predicate = bindingSet.getValue("p"); Value object = bindingSet.getValue("o"); if(predicate instanceof URI) { triples.add(ValueFactoryImpl.getInstance().createStatement(subject,(URI)predicate,object)); } else { log.error("ignoring binding as predicate {} is not a URI",predicate); } }
/** * Checks whether the given object is a primitive type and, if so, will return a * Node that encodes it. Otherwise NULL is returned. * * @param o * The object to check * @return a Node or NULL */ private Value checkPrimitive(final Object o) { if (o instanceof String) return new LiteralImpl(o.toString()); if (o instanceof Integer) return new ValueFactoryImpl().createLiteral((Integer) o); if (o instanceof Float) return new ValueFactoryImpl().createLiteral((Float) o); if (o instanceof Double) return new ValueFactoryImpl().createLiteral((Double) o); if (o instanceof URI || o instanceof URL || o instanceof java.net.URI) return new URIImpl(o.toString()); return null; }
@Override public void readFields(DataInput dataInput) throws IOException { ValueFactoryImpl vfi = new ValueFactoryImpl(); String data = dataInput.readLine(); String dataTypeString = dataInput.readLine(); URI dataType = vfi.createURI(dataTypeString); ryatype.setData(data); ryatype.setDataType(dataType); }
public URI createURI(String namespace, String localName) { return createURI(namespace + localName); }
final String tagName, final String authorUri) throws RDFHandlerException final ValueFactoryImpl vf = ValueFactoryImpl.getInstance(); final RDFFormat format = Rio.getWriterFormatForMIMEType(outputFormat); final Model model = new LinkedHashModel(); annotationIdentifier = vf.createBNode(); annotationIdentifier = vf.createURI(annotationUri); model.add(annotationIdentifier, OasConstants.TAGGING_TAGGED_RESOURCE, vf.createURI(taggedResourceUri)); if(authorUri != null) model.add(annotationIdentifier, OasConstants.FOAF_MAKER, vf.createURI(authorUri)); model.add(annotationIdentifier, OasConstants.TAGGING_NAME, vf.createLiteral(tagName)); model.add(annotationIdentifier, OasConstants.MOAT_TAG_MEANING, vf.createURI(ontologyUri)); if(taggedResourceType != null) model.add(vf.createURI(taggedResourceUri), RDF.TYPE, vf.createURI(taggedResourceType));
private Map<String, Value> getBindings(Map<String, Object> variables) { Map<String, Value> bindings = new HashMap<String, Value>(); for (Map.Entry<String, Object> stringObjectEntry : variables.entrySet()) { if (!stringObjectEntry.getValue().getClass().equals(Object.class)) bindings.put(stringObjectEntry.getKey(), ValueFactoryImpl.getInstance().createLiteral(stringObjectEntry.getValue().toString())); } return bindings; } }
/** * Create a RdfValueFactory that does use the same {@link Model} for all * created {@link Representation}s. * @param model the model to use * @param sesameFactory the Sesame ValueFactory or <code>null</code> to use * the default */ public RdfValueFactory(Model model, org.openrdf.model.ValueFactory sesameFactory){ this.model = model; this.sesameFactory = sesameFactory == null ? ValueFactoryImpl.getInstance() : sesameFactory;; } /**
@Override public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException { Value predicate = bindingSet.getValue("p"); Value object = bindingSet.getValue("o"); if(predicate instanceof URI) { triples.add(ValueFactoryImpl.getInstance().createStatement(subject,(URI)predicate,object)); } else { log.error("ignoring binding as predicate {} is not a URI",predicate); } }
/** * Checks whether the given object is a primitive type and, if so, will * return a Node that encodes it. Otherwise NULL is returned. * * @param o The object to check * @return a Node or NULL */ private Value checkPrimitive( final Object o ) { if( o instanceof String ) return new LiteralImpl( o.toString() ); if( o instanceof Integer ) return new ValueFactoryImpl().createLiteral( (Integer) o ); if( o instanceof Float ) return new ValueFactoryImpl().createLiteral( (Float) o ); if( o instanceof Double ) return new ValueFactoryImpl().createLiteral( (Double) o ); if( o instanceof URI || o instanceof URL || o instanceof java.net.URI ) return new URIImpl( o.toString() ); return null; }
public LdpServiceImpl() { ldpContext = ValueFactoryImpl.getInstance().createURI(LDP.NAMESPACE); ldpInteractionModelProperty = ValueFactoryImpl.getInstance().createURI(LDP.NAMESPACE, "interactionModel"); ldpUsed = ValueFactoryImpl.getInstance().createURI(LDP.NAMESPACE, "used"); }
final ValueFactoryImpl vf = ValueFactoryImpl.getInstance(); final URI s = vf.createURI("s:s1"); final Literal o = vf.createLiteral("literal"); vf.createStatement(s, RDFS.LABEL, o),
/** * Creates a new XmlAdminMsgReader that will use the supplied * <tt>XMLReader</tt> for parsing the XML admin message documents and an * instance of <tt>ValueFactoryImpl</tt> to create any model objects. **/ public XmlAdminMsgReader(XMLReader xmlReader) { this(xmlReader, new ValueFactoryImpl()); }
private Map<String, Value> getBindings(Map<String, Object> variables) { Map<String, Value> bindings = new HashMap<>(); for (Map.Entry<String, Object> stringObjectEntry : variables.entrySet()) { if (!stringObjectEntry.getValue().getClass().equals(Object.class)) bindings.put(stringObjectEntry.getKey(), ValueFactoryImpl.getInstance().createLiteral(stringObjectEntry.getValue().toString())); } return bindings; } }
@Deprecated @Override public final ValueFactory getValueFactory() { return ValueFactoryImpl.getInstance(); }