/** * 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. * @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(IRI predicate, Object object) { if (currentSubject == null) { throw new ModelException("subject not set"); } return add(currentSubject, 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 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. * @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(IRI predicate, Object object) { if (currentSubject == null) { throw new ModelException("subject not set"); } return add(currentSubject, 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. 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 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); }