/** * Set the current graph in which to add new statements to the supplied named graph. This method clears * the current subject. * * @param namedGraph * a named graph identifier. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @return this {@link ModelBuilder} */ public ModelBuilder namedGraph(String prefixedNameOrIRI) { return namedGraph(mapToIRI(prefixedNameOrIRI)); }
/** * Set the current graph in which to add new statements to the supplied named graph. This method clears * the current subject. * * @param namedGraph * a named graph identifier. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @return this {@link ModelBuilder} */ public ModelBuilder namedGraph(String prefixedNameOrIRI) { return namedGraph(mapToIRI(prefixedNameOrIRI)); }
/** * Add an RDF statement with the given subject, predicate and object to the model, using the current graph * (either named or default). * * @param subject * the statement's subject. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param predicate * the statement's predicate. This can be defined either as a prefixed name string (e.g. * "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, * the {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @see #namedGraph(Resource) * @see #defaultGraph() * @see Literals#createLiteral(ValueFactory, Object) */ public ModelBuilder add(String subject, String predicate, Object object) { return add(mapToIRI(subject), mapToIRI(predicate), object); }
/** * Set the subject about which statements are to be added to the model, defined by a prefixed name or an * IRI reference. * * @param subject * the subject resource about which statements are to be added. This can be defined either as a * prefixed name string (e.g. "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If * supplied as a prefixed name, the {@link ModelBuilder} will need to have a namespace mapping for * the prefix. * @return the {@link ModelBuilder} */ public ModelBuilder subject(String prefixedNameOrIri) { return subject(mapToIRI(prefixedNameOrIri)); }
/** * Set the subject about which statements are to be added to the model, defined by a prefixed name or an * IRI reference. * * @param subject * the subject resource about which statements are to be added. This can be defined either as a * prefixed name string (e.g. "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If * supplied as a prefixed name, the {@link ModelBuilder} will need to have a namespace mapping for * the prefix. * @return the {@link ModelBuilder} */ public ModelBuilder subject(String prefixedNameOrIri) { return subject(mapToIRI(prefixedNameOrIri)); }
/** * Add an RDF statement with the given subject, predicate and object to the model, using the current graph * (either named or default). * * @param subject * the statement's subject. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param predicate * the statement's predicate. This can be defined either as a prefixed name string (e.g. * "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, * the {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @see #namedGraph(Resource) * @see #defaultGraph() * @see Literals#createLiteral(ValueFactory, Object) */ public ModelBuilder add(String subject, String predicate, Object object) { return add(mapToIRI(subject), mapToIRI(predicate), object); }
/** * Add an RDF statement with the predicate and object to the model, using the current subject and graph * (either named or default). * * @param predicate * the statement's predicate. This can be defined either as a prefixed name string (e.g. * "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, * the {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @throws ModelException * if the current subject is not set using {@link #subject(Resource)} or {@link #subject(String)}. */ public ModelBuilder add(String predicate, Object object) { return add(mapToIRI(predicate), object); }
/** * Add an RDF statement with the predicate and object to the model, using the current subject and graph * (either named or default). * * @param predicate * the statement's predicate. This can be defined either as a prefixed name string (e.g. * "ex:john"), or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, * the {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @throws ModelException * if the current subject is not set using {@link #subject(Resource)} or {@link #subject(String)}. */ public ModelBuilder add(String predicate, Object object) { return add(mapToIRI(predicate), object); }
/** * Add an RDF statement with the given subject, predicate and object to the model, using the current graph * (either named or default). * * @param subject * the statement's subject. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param predicate * the statement's predicate * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @see #namedGraph(Resource) * @see #defaultGraph() * @see Literals#createLiteral(ValueFactory, Object) */ public ModelBuilder add(String subject, IRI predicate, Object object) { return add(mapToIRI(subject), predicate, object); }
/** * Add an RDF statement with the given subject, predicate and object to the model, using the current graph * (either named or default). * * @param subject * the statement's subject. This can be defined either as a prefixed name string (e.g. "ex:john"), * or as a full IRI (e.g. "http://example.org/john"). If supplied as a prefixed name, the * {@link ModelBuilder} will need to have a namespace mapping for the prefix. * @param predicate * the statement's predicate * @param object * the statement's object. If the supplied object is a {@link BNode}, {@link IRI}, or * {@link Literal}, the object is used directly. If it is a prefixed name String with a known * prefix, it is mapped to an IRI. Otherwise a typed {@link Literal} is created out of the supplied * object, mapping the runtime type of the object to the appropriate XML Schema type. If no mapping * is available, the method creates a literal with the string representation of the supplied object * as the value, and {@link XMLSchema#STRING} as the datatype. Recognized types are {@link Boolean} * , {@link Byte}, {@link Double}, {@link Float}, {@link Integer}, {@link Long}, {@link Short}, * {@link XMLGregorianCalendar } , and {@link Date}. * @return this {@link ModelBuilder} * @see #namedGraph(Resource) * @see #defaultGraph() * @see Literals#createLiteral(ValueFactory, Object) */ public ModelBuilder add(String subject, IRI predicate, Object object) { return add(mapToIRI(subject), predicate, object); }