public class ContentBuilder<PARENT extends won.protocol.message.builder.BuilderScaffold<PARENT,?>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected WonMessageBuilder |
builder |
protected java.util.Optional<PARENT> |
parent |
| Constructor and Description |
|---|
ContentBuilder(PARENT parent) |
| Modifier and Type | Method and Description |
|---|---|
PARENT |
addToMessageResource(org.apache.jena.rdf.model.Property property,
java.util.Collection<java.net.URI> uriValues)
Adds the specified property once with each value.
|
PARENT |
addToMessageResource(org.apache.jena.rdf.model.Property property,
java.net.URI... uriValues)
Adds the specified property once with each value.
|
PARENT |
dataset(org.apache.jena.query.Dataset content)
Adds all models in the dataset as content graphs to the message, including
the default model.
|
PARENT |
model(org.apache.jena.rdf.model.Model content)
Adds the specified model as a content graph to the message.
|
PARENT |
text(java.lang.String text)
Adds a Text message to one of the message's content graphs.
|
PARENT |
withContentGraph(java.util.function.Consumer<org.apache.jena.rdf.model.Model> dataAdder)
Exposes the content graph, which is passed to the specified Consumer.
|
PARENT |
withMessageResource(java.util.function.Consumer<org.apache.jena.rdf.model.Resource> dataAdder)
Exposes the RDF resource that identifies the message itself.
|
protected java.util.Optional<PARENT extends won.protocol.message.builder.BuilderScaffold<PARENT,?>> parent
protected WonMessageBuilder builder
public ContentBuilder(PARENT parent)
public PARENT model(org.apache.jena.rdf.model.Model content)
content - public PARENT withMessageResource(java.util.function.Consumer<org.apache.jena.rdf.model.Resource> dataAdder)
Exposes the RDF resource that identifies the message itself. The specified Consumer is given the resource that identifies the message. Any data added to the resource is put in one of the message's content graphs. If there already is one content graph, that one is used. If there is none yet, a new one is created. If there are more than one, another one is added.
For example, to add a text message this way::
.withMessageResource(r -> r.addProperty(WONCON.text, "Hello, World!"))To propose the content of previous message with URI
prevURI
.withMessageResource(r -> r.addProperty(WONAGR.proposes, r.getResource(prevURI))
public PARENT withContentGraph(java.util.function.Consumer<org.apache.jena.rdf.model.Model> dataAdder)
public PARENT text(java.lang.String text)
Adds a Text message to one of the message's content graphs. If only one graph is present, the text message is added to that graph. If more than one graph is present, and hence we cannot decide for any one of them, a new content graph is created for the text. If no content graphs are present, a new one is created. If the text is null or empty, this call has no effect.
.text("Hello, World!")
is equivalent to:
.withMessageResource(r -> r.addProperty(WONCON.text, "Hello, World!"))
textMessage - public PARENT dataset(org.apache.jena.query.Dataset content)
content - public PARENT addToMessageResource(org.apache.jena.rdf.model.Property property,
java.net.URI... uriValues)
property - the property to adduriValues - the values to add as objectspublic PARENT addToMessageResource(org.apache.jena.rdf.model.Property property,
java.util.Collection<java.net.URI> uriValues)
property - the property to adduriValues - the values to add as objectsCopyright © 2019. All Rights Reserved.