Class RdfSerializer.Builder<SELF extends RdfSerializer.Builder<SELF>>
- Direct Known Subclasses:
RdfSerializer.DefaultBuilder
- Enclosing class:
- RdfSerializer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor, default settings.protectedBuilder(RdfSerializer copyFrom) Copy constructor.protectedBuilder(RdfSerializer.Builder<?> copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdd"_type" properties when needed.addBeanTypesRdf(boolean value) Same asaddBeanTypesRdf()but allows you to explicitly specify the value.Add XSI data types to non-String literals.addLiteralTypes(boolean value) Add XSI data types to non-String literals.Add RDF root identifier property to root node.addRootProperty(boolean value) Add RDF root identifier property to root node.build()Build the object.RDF format for representing collections and arrays.abstract SELFcopy()Copy creator.Disable auto-detect namespace usage.disableAutoDetectNamespaces(boolean value) Disable auto-detect namespace usage.Disable reuse of XML namespaces when RDF namespaces not specified.disableUseXmlNamespaces(boolean value) Disable reuse of XML namespaces when RDF namespaces not specified.hashKey()Returns the hashkey of this builder.jsonLd()RDF language.juneauBpNs(Namespace value) Default XML namespace for bean properties.XML namespace for Juneau properties.RDF language.Collections should be serialized and parsed as loose collections.looseCollections(boolean value) Collections should be serialized and parsed as loose collections.n3()RDF language.N3/Turtle property:disableAbbrevBaseURI .n3_disableAbbrevBaseUri(boolean value) N3/Turtle property:disableAbbrevBaseURI .N3/Turtle property:disableObjectLists .n3_disableObjectLists(boolean value) N3/Turtle property:disableObjectLists .N3/Turtle property:disableUseDoubles .n3_disableUseDoubles(boolean value) N3/Turtle property:disableUseDoubles .N3/Turtle property:disableUsePropertySymbols .n3_disableUsePropertySymbols(boolean value) N3/Turtle property:disableUsePropertySymbols .N3/Turtle property:disableUseTripleQuotedStrings .n3_disableUseTripleQuotedStrings(boolean value) N3/Turtle property:disableUseTripleQuotedStrings .n3_indentProperty(int value) N3/Turtle property:indentProperty .n3_minGap(int value) N3/Turtle property:minGap .n3_propertyColumn(int value) N3/Turtle property:propertyColumn .n3_subjectColumn(int value) N3/Turtle property:subjectColumn .n3_widePropertyLen(int value) N3/Turtle property:widePropertyLen .namespaces(Namespace... values) Default namespaces.nQuads()RDF language.ntriple()RDF language.rdfJson()RDF language.RDF/XML property:allowBadURIs .rdfxml_allowBadUris(boolean value) RDF/XML property:allowBadURIs .rdfxml_attributeQuoteChar(char value) RDF/XML property:attributeQuoteChar .rdfxml_blockRules(String value) RDF/XML property:blockRules .RDF/XML property:disableShowDoctypeDeclaration .rdfxml_disableShowDoctypeDeclaration(boolean value) RDF/XML property:disableShowDoctypeDeclaration .RDF/XML ARP property:error-mode .rdfxml_embedding(boolean value) RDF/XML ARP property:error-mode .rdfxml_errorMode(String value) RDF/XML ARP property:error-mode .rdfxml_iriRules(String value) RDF/XML property:iri_rules .RDF/XML property:longId .rdfxml_longId(boolean value) RDF/XML property:longId .rdfxml_relativeUris(String value) RDF/XML property:relativeURIs .rdfxml_showXmlDeclaration(String value) RDF/XML property:showXmlDeclaration .rdfxml_tab(int value) RDF/XML property:tab .rdfxml_xmlbase(String value) RDF/XML property:xmlbase .triG()RDF language.triX()RDF language.turtle()RDF language.xml()RDF language.RDF language.Methods inherited from class org.apache.juneau.marshall.serializer.WriterSerializer.Builder
maxIndent, quoteChar, quoteCharOverride, sq, streamCharset, useWhitespace, useWhitespace, wsMethods inherited from class org.apache.juneau.marshall.serializer.Serializer.Builder
accept, addBeanTypes, addBeanTypes, addRootType, addRootType, getAccept, getProduces, keepNullProperties, keepNullProperties, listener, nonDefault, nonDefault, produces, sortCollections, sortCollections, sortMaps, sortMaps, trimEmptyCollections, trimEmptyCollections, trimEmptyMaps, trimEmptyMaps, trimStrings, trimStrings, uriContext, uriRelativity, uriResolutionMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext.Builder
detectRecursions, detectRecursions, ignoreRecursions, ignoreRecursions, initialDepth, maxDepthMethods inherited from class org.apache.juneau.marshall.MarshallingContextable.Builder
activeView, annotations, beanClassVisibility, beanConstructorVisibility, beanDictionary, beanFieldVisibility, beanInterceptor, beanMapPutReturnsOldValue, beanMethodVisibility, beanProperties, beanProperties, beanProperties, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, bigNumberFormat, binaryFormat, bitSetFormat, booleanFormat, calendarFormat, classFormat, classLoader, currencyFormat, dateFormat, debug, dictionaryOn, disableBeansRequireSomeProperties, disableDefaultViewInclusion, disableIgnoreMissingSetters, disableIgnoreTransientFields, disableIgnoreUnknownNullBeanProperties, disableInterfaceProxies, durationFormat, enumFormat, example, example, findFluentSetters, findFluentSetters, floatFormat, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignoreUnknownBeanProperties, ignoreUnknownEnumValues, implClass, implClasses, interfaceClass, interfaces, locale, localeFormat, marshallingContext, marshallingContext, marshallingContext, marshallingContext, mediaType, notBeanClasses, notBeanPackages, periodFormat, propertyNamer, propertyNamer, recordComponentOrder, stopClass, swap, swap, swaps, swaps, temporalFormat, timeZone, timeZoneFormat, typeName, typePropertyName, typePropertyName, unsortedProperties, unsortedProperties, useJavaBeanIntrospector, uuidFormat, validateSchema, validateSchemaMethods inherited from class org.apache.juneau.marshall.Context.Builder
annotations, apply, applyAnnotations, applyAnnotations, asSubtype, build, cache, canApply, copyOrNull, debug, getApplied, getType, impl, isDebug, registerBuilders, self, type
-
Constructor Details
-
Builder
protected Builder()Constructor, default settings. -
Builder
Copy constructor.- Parameters:
copyFrom- The builder to copy from.
Cannot benull .
-
Builder
Copy constructor.- Parameters:
copyFrom- The bean to copy from.
Cannot benull .
-
-
Method Details
-
addBeanTypesRdf
Add"_type" properties when needed.If
true , then"_type" properties will be added to beans if their type cannot be inferred through reflection.When present, this value overrides the
Serializer.Builder#addBeanTypes()setting and is provided to customize the behavior of specific serializers in aSerializerSet.- Returns:
- This object.
-
addBeanTypesRdf
Same asaddBeanTypesRdf()but allows you to explicitly specify the value.- Parameters:
value- The value for this setting.- Returns:
- This object.
-
addLiteralTypes
Add XSI data types to non-String literals.Shortcut for calling
addLiteralTypes(.true )- Returns:
- This object.
-
addLiteralTypes
Add XSI data types to non-String literals.Shortcut for calling
addLiteralTypes(.true )- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
addRootProperty
Add RDF root identifier property to root node.When enabled an RDF property
http://www.apache.org/juneau/root is added with a value of"true" to identify the root node in the graph.
This helps locate the root node during parsing.If disabled, the parser has to search through the model to find any resources without incoming predicates to identify root notes, which can introduce a considerable performance degradation.
- Returns:
- This object.
-
addRootProperty
Add RDF root identifier property to root node.When enabled an RDF property
http://www.apache.org/juneau/root is added with a value of"true" to identify the root node in the graph.
This helps locate the root node during parsing.If disabled, the parser has to search through the model to find any resources without incoming predicates to identify root notes, which can introduce a considerable performance degradation.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
build
Description copied from class:Context.BuilderBuild the object.- Overrides:
buildin classWriterSerializer.Builder<SELF extends RdfSerializer.Builder<SELF>>- Returns:
- The built object.
-
collectionFormat
RDF format for representing collections and arrays."DEFAULT" - Default format. The default is an RDF Sequence container."SEQ" - RDF Sequence container."BAG" - RDF Bag container."LIST" - RDF List container."MULTI_VALUED" - Multi-valued properties.
Notes:
-
If you use
"BAG" or"MULTI_VALUED" , the order of the elements in the collection will get lost.
- Parameters:
value- The new value for this setting.
Cannot benull .- Returns:
- This object.
-
copy
Description copied from class:Context.BuilderCopy creator.- Specified by:
copyin classWriterSerializer.Builder<SELF extends RdfSerializer.Builder<SELF>>- Returns:
- A new mutable copy of this builder.
-
disableAutoDetectNamespaces
Disable auto-detect namespace usage.Don't detect namespace usage before serialization.
If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before the root element is serialized.
- Returns:
- This object.
-
disableAutoDetectNamespaces
Disable auto-detect namespace usage.Don't detect namespace usage before serialization.
If enabled, then the data structure will first be crawled looking for namespaces that will be encountered before the root element is serialized.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
disableUseXmlNamespaces
Disable reuse of XML namespaces when RDF namespaces not specified.When enabled, namespaces defined using
@XmlNsandXmlwill not be inherited by the RDF serializers. Otherwise, namespaces will be defined using@RdfNsand@Rdf.- Returns:
- This object.
-
disableUseXmlNamespaces
Disable reuse of XML namespaces when RDF namespaces not specified.When enabled, namespaces defined using
@XmlNsandXmlwill not be inherited by the RDF serializers. Otherwise, namespaces will be defined using@RdfNsand@Rdf.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
hashKey
Description copied from class:Context.BuilderReturns the hashkey of this builder.Used to return previously instantiated context beans that have matching hashkeys. The
HashKeyobject is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if theHashKey.equals(Object)method is the same.- Overrides:
hashKeyin classWriterSerializer.Builder<SELF extends RdfSerializer.Builder<SELF>>- Returns:
- The hashkey of this builder.
-
juneauBpNs
Default XML namespace for bean properties.- Parameters:
value- The new value for this setting.
The default is{j:.'http://www.apache.org/juneaubp/' }
Cannot benull .- Returns:
- This object.
-
juneauNs
XML namespace for Juneau properties.- Parameters:
value- The new value for this setting.
The default is{j:.'http://www.apache.org/juneau/' }
Cannot benull .- Returns:
- This object.
-
language
RDF language.Can be any of the following:
-
"RDF/XML" -
"RDF/XML-ABBREV" (default) -
"N-TRIPLE" -
"N3" - General name for the N3 writer. Will make a decision on exactly which writer to use (pretty writer, plain writer or simple writer) when created. Default is the pretty writer but can be overridden with system propertyorg.apache.jena.n3.N3JenaWriter.writer . -
"N3-PP" - Name of the N3 pretty writer. The pretty writer uses a frame-like layout, with prefixing, clustering like properties and embedding one-referenced bNodes. -
"N3-PLAIN" - Name of the N3 plain writer. The plain writer writes records by subject. -
"N3-TRIPLES" - Name of the N3 triples writer. This writer writes one line per statement, like N-Triples, but does N3-style prefixing. -
"TURTLE" - Turtle writer. http://www.dajobe.org/2004/01/turtle/
See Also:
- Parameters:
value- The new value for this setting.
Cannot benull .- Returns:
- This object.
-
-
looseCollections
Collections should be serialized and parsed as loose collections.When specified, collections of resources are handled as loose collections of resources in RDF instead of resources that are children of an RDF collection (e.g. Sequence, Bag).
Note that this setting is specialized for RDF syntax, and is incompatible with the concept of losslessly representing POJO models, since the tree structure of these POJO models are lost when serialized as loose collections.
This setting is typically only useful if the beans being parsed into do not have a bean property annotated with
@Rdf(beanUri=true).Example:
WriterSerializer
serializer = RdfSerializer .create () .xmlabbrev() .looseCollections() .build(); ReaderParserparser = RdfParser .create () .xml() .looseCollections() .build(); List<MyBean>list =createListOfMyBeans ();// Serialize to RDF/XML as loose resources StringrdfXml =serializer .write(list );// Parse back into a Java collection list =parser .read(rdfXml , LinkedList.class , MyBean.class ); MyBean[]beans =createArrayOfMyBeans ();// Serialize to RDF/XML as loose resources rdfXml =serializer .write(beans );// Parse back into a bean array beans =parser .read(rdfXml , MyBean[].class );- Returns:
- This object.
-
looseCollections
Collections should be serialized and parsed as loose collections.When specified, collections of resources are handled as loose collections of resources in RDF instead of resources that are children of an RDF collection (e.g. Sequence, Bag).
Note that this setting is specialized for RDF syntax, and is incompatible with the concept of losslessly representing POJO models, since the tree structure of these POJO models are lost when serialized as loose collections.
This setting is typically only useful if the beans being parsed into do not have a bean property annotated with
@Rdf(beanUri=true).Example:
WriterSerializer
serializer = RdfSerializer .create () .xmlabbrev() .looseCollections() .build(); ReaderParserparser = RdfParser .create () .xml() .looseCollections() .build(); List<MyBean>list =createListOfMyBeans ();// Serialize to RDF/XML as loose resources StringrdfXml =serializer .write(list );// Parse back into a Java collection list =parser .read(rdfXml , LinkedList.class , MyBean.class ); MyBean[]beans =createArrayOfMyBeans ();// Serialize to RDF/XML as loose resources rdfXml =serializer .write(beans );// Parse back into a bean array beans =parser .read(rdfXml , MyBean[].class );- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3
RDF language.Shortcut for calling
language(LANG_N3 )- Returns:
- This object.
-
n3_disableAbbrevBaseUri
N3/Turtle property:disableAbbrevBaseURI .Controls whether to use abbreviations
<> or<#> .- Returns:
- This object.
-
n3_disableAbbrevBaseUri
N3/Turtle property:disableAbbrevBaseURI .Controls whether to use abbreviations
<> or<#> .- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_disableObjectLists
N3/Turtle property:disableObjectLists .Don't print object lists as comma separated lists.
- Returns:
- This object.
-
n3_disableObjectLists
N3/Turtle property:disableObjectLists .Don't print object lists as comma separated lists.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_disableUseDoubles
N3/Turtle property:disableUseDoubles .Disallow the use of doubles as
123.456 .- Returns:
- This object.
-
n3_disableUseDoubles
N3/Turtle property:disableUseDoubles .Disallow the use of doubles as
123.456 .- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_disableUsePropertySymbols
N3/Turtle property:disableUsePropertySymbols .Controls whether to use
a ,= and=> in output- Returns:
- This object.
-
n3_disableUsePropertySymbols
N3/Turtle property:disableUsePropertySymbols .Controls whether to use
a ,= and=> in output- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_disableUseTripleQuotedStrings
N3/Turtle property:disableUseTripleQuotedStrings .Disallow the use of
""" to delimit long strings.- Returns:
- This object.
-
n3_disableUseTripleQuotedStrings
N3/Turtle property:disableUseTripleQuotedStrings .Disallow the use of
""" to delimit long strings.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_indentProperty
N3/Turtle property:indentProperty .Width to indent properties.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_minGap
N3/Turtle property:minGap .Minimum gap between items on a line.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_propertyColumn
N3/Turtle property:propertyColumn .Width of the property column.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_subjectColumn
N3/Turtle property:subjectColumn .If the subject is shorter than this value, the first property may go on the same line.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
n3_widePropertyLen
N3/Turtle property:widePropertyLen .Width of the property column. Must be longer than
propertyColumn .- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
namespaces
Default namespaces.The default list of namespaces associated with this serializer.
- Parameters:
values- The new value for this setting.
Cannot containnull values (will throwIllegalArgumentException).- Returns:
- This object.
-
ntriple
RDF language.Shortcut for calling
language(LANG_NTRIPLE )- Returns:
- This object.
-
rdfxml_allowBadUris
RDF/XML property:allowBadURIs .URIs in the graph are, by default, checked prior to serialization.
- Returns:
- This object.
-
rdfxml_allowBadUris
RDF/XML property:allowBadURIs .URIs in the graph are, by default, checked prior to serialization.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_attributeQuoteChar
RDF/XML property:attributeQuoteChar .The XML attribute quote character.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_blockRules
RDF/XML property:blockRules .A list of
Resource or aString being a comma separated list of fragment IDs from {doc http://www.w3.org/TR/rdf-syntax-grammar RDF Syntax Grammar} indicating grammar rules that will not be used.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_disableShowDoctypeDeclaration
RDF/XML property:disableShowDoctypeDeclaration .If disabled, an XML doctype declaration isn't included in the output. This declaration includes a
!ENTITY declaration for each prefix mapping in the model, and any attribute value that starts with the URI of that mapping is written as starting with the corresponding entity invocation.- Returns:
- This object.
-
rdfxml_disableShowDoctypeDeclaration
RDF/XML property:disableShowDoctypeDeclaration .If disabled, an XML doctype declaration isn't included in the output. This declaration includes a
!ENTITY declaration for each prefix mapping in the model, and any attribute value that starts with the URI of that mapping is written as starting with the corresponding entity invocation.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_embedding
RDF/XML ARP property:error-mode .Sets ARP to look for RDF embedded within an enclosing XML document.
See Also:
- {doc ext.ARP/ARPOptions.html#setEmbedding(boolean) ARPOptions.setEmbedding(boolean)}
- Returns:
- This object.
-
rdfxml_embedding
RDF/XML ARP property:error-mode .Sets ARP to look for RDF embedded within an enclosing XML document.
See Also:
- {doc ext.ARP/ARPOptions.html#setEmbedding(boolean) ARPOptions.setEmbedding(boolean)}
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_errorMode
RDF/XML ARP property:error-mode .This allows a coarse-grained approach to control of error handling.
"default" "lax" "strict" "strict-ignore" "strict-warning" "strict-error" "strict-fatal"
See Also:
- {doc ext.ARP/ARPOptions.html#setDefaultErrorMode() ARPOptions.setDefaultErrorMode()}
- {doc ext.ARP/ARPOptions.html#setLaxErrorMode() ARPOptions.setLaxErrorMode()}
- {doc ext.ARP/ARPOptions.html#setStrictErrorMode() ARPOptions.setStrictErrorMode()}
- {doc ext.ARP/ARPOptions.html#setStrictErrorMode(int) ARPOptions.setStrictErrorMode(int)}
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_iriRules
RDF/XML property:iri_rules .Set the engine for checking and resolving.
-
"lax" - The rules for RDF URI references only, which does permit spaces although the use of spaces is not good practice. -
"strict" - Sets the IRI engine with rules for valid IRIs, XLink and RDF; it does not permit spaces in IRIs. -
"iri" - Sets the IRI engine to IRI ({doc http://www.ietf.org/rfc/rfc3986.txt RFC 3986}, {doc http://www.ietf.org/rfc/rfc3987.txt RFC 3987}).
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
-
rdfxml_longId
RDF/XML property:longId .Whether to use long ID's for anon resources. Short ID's are easier to read, but can run out of memory on very large models.
- Returns:
- This object.
-
rdfxml_longId
RDF/XML property:longId .Whether to use long ID's for anon resources. Short ID's are easier to read, but can run out of memory on very large models.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_relativeUris
RDF/XML property:relativeURIs .What sort of relative URIs should be used.
A comma separate list of options:
-
"same-document" - Same-document references (e.g."" or"#foo" ) -
"network" - Network paths (e.g."//example.org/foo" omitting the URI scheme) -
"absolute" - Absolute paths (e.g."/foo" omitting the scheme and authority) -
"relative" - Relative path not beginning in"../" -
"parent" - Relative path beginning in"../" -
"grandparent" - Relative path beginning in"../../"
The default value is
"same-document, absolute, relative, parent" . To switch off relative URIs use the value"" . Relative URIs of any of these types are output where possible if and only if the option has been specified.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
-
rdfxml_showXmlDeclaration
RDF/XML property:showXmlDeclaration .-
"true" - Add XML Declaration to the output. -
"false" - Don't add XML Declaration to the output. -
"default" - Only add an XML Declaration when asked to write to anOutputStreamWriter that uses some encoding other thanUTF-8 orUTF-16 . In this case the encoding is shown in the XML declaration.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
-
rdfxml_tab
RDF/XML property:tab .The number of spaces with which to indent XML child elements.
- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
rdfxml_xmlbase
RDF/XML property:xmlbase .The value to be included for an
xml:base attribute on the root element in the file.- Parameters:
value- The new value for this setting.- Returns:
- This object.
-
turtle
RDF language.Shortcut for calling
language(LANG_TURTLE )- Returns:
- This object.
-
jsonLd
RDF language.Shortcut for calling
language(LANG_JSONLD )- Returns:
- This object.
-
nQuads
RDF language.Shortcut for calling
language(LANG_NQUADS )- Returns:
- This object.
-
triG
RDF language.Shortcut for calling
language(LANG_TRIG )- Returns:
- This object.
-
triX
RDF language.Shortcut for calling
language(LANG_TRIX )- Returns:
- This object.
-
rdfJson
RDF language.Shortcut for calling
language(LANG_RDFJSON )- Returns:
- This object.
-
xml
RDF language.Shortcut for calling
language(LANG_RDF_XML )- Returns:
- This object.
-
xmlabbrev
RDF language.Shortcut for calling
language(LANG_RDF_XML_ABBREV )- Returns:
- This object.
-