Package org.apache.juneau.marshall.jena
Class RdfSerializer
- All Implemented Interfaces:
Function<Object,,String> ThrowingFunction<Object,,String> RdfMetaProvider,XmlMetaProvider
- Direct Known Subclasses:
JsonLdSerializer,N3Serializer,NQuadsSerializer,NTripleSerializer,RdfJsonSerializer,RdfXmlAbbrevSerializer,RdfXmlSerializer,TriGSerializer,TriXSerializer,TurtleSerializer
Serializes POJOs to RDF.
Behavior-specific subclasses
The following direct subclasses are provided for language-specific serializers:
RdfXmlSerializer- RDF/XML.RdfXmlAbbrevSerializer- RDF/XML-ABBREV.NTripleSerializer- N-TRIPLE.TurtleSerializer- TURTLE.N3Serializer- N3.
Notes:
- This class is thread safe and reusable.
See Also:
- {doc jmr.RdfDetails}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRdfSerializer.Builder<SELF extends RdfSerializer.Builder<SELF>>Builder class.static final classNested classes/interfaces inherited from class org.apache.juneau.marshall.serializer.Serializer
Serializer.Null -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final booleanprotected final booleanprotected final booleanprotected final RdfCollectionFormatprotected final Namespaceprotected final Namespaceprotected final Stringprotected final booleanprotected final booleanFields inherited from class org.apache.juneau.marshall.serializer.WriterSerializer
maxIndent, quoteChar, quoteCharOverride, useWhitespaceFields inherited from class org.apache.juneau.marshall.serializer.Serializer
accept, addBeanTypes, addRootType, keepNullProperties, listener, nonDefault, produces, sortCollections, sortMaps, trimEmptyCollections, trimEmptyMaps, trimStringsFields inherited from class org.apache.juneau.marshall.MarshallingContextable
marshallingContextFields inherited from class org.apache.juneau.marshall.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a builder from this context object.static RdfSerializer.Builder<?>create()Creates a new builder for this object.Create a session builder based on the properties defined on this context.protected final RdfCollectionFormatRDF format for representing collections and arrays.All Jena-related configuration properties.protected final NamespaceDefault XML namespace for bean properties.protected final NamespaceXML namespace for Juneau properties.protected final StringRDF language.Default namespaces.getRdfBeanMeta(BeanMeta<?> bm) Returns the language-specific metadata on the specified bean.Returns the language-specific metadata on the specified bean property.getRdfClassMeta(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.Returns a session to use for this context.getXmlBeanMeta(BeanMeta<?> bm) Returns the language-specific metadata on the specified bean.Returns the language-specific metadata on the specified bean property.getXmlClassMeta(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.protected final booleanAdd"_type" properties when needed.protected final booleanAdd XSI data types to non-String literals.protected final booleanAdd RDF root identifier property to root node.protected final booleanAuto-detect namespace usage.protected final booleanCollections should be serialized and parsed as loose collections.protected final booleanReuse XML namespaces when RDF namespaces not specified.Returns the properties on this bean as a map for debugging.Methods inherited from class org.apache.juneau.marshall.serializer.WriterSerializer
applyThrows, getMaxIndent, getQuoteChar, getStreamCharset, isUseWhitespace, isWriterSerializer, println, quoteChar, toString, writeMethods inherited from class org.apache.juneau.marshall.serializer.Serializer
createSerializerBuilder, doWrite, forEachAcceptMediaType, getListener, getMediaTypeRanges, getPrimaryMediaType, getResponseContentType, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, isAddRootType, isKeepNullProperties, isNonDefault, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, write, writeToStringMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext
getDetectRecursions, getIgnoreRecursions, getInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursions, shouldDetectRecursionsMethods inherited from class org.apache.juneau.marshall.MarshallingContextable
getDurationFormat, getMarshallingContext, getPeriodFormatMethods inherited from class org.apache.juneau.marshall.Context
createBuilder, getAnnotationProvider, init, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.commons.function.ThrowingFunction
apply
-
Field Details
-
addBeanTypesRdf
-
addLiteralTypes
-
addRootProperty
-
autoDetectNamespaces
-
looseCollections
-
useXmlNamespaces
-
juneauBpNs
-
juneauNs
-
collectionFormat
-
language
-
-
Constructor Details
-
RdfSerializer
Constructor.- Parameters:
builder- The builder for this object.
Cannot benull .
-
-
Method Details
-
create
Creates a new builder for this object.- Returns:
- A new builder.
-
copy
Description copied from class:ContextCreates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
- Overrides:
copyin classWriterSerializer- Returns:
- A new Builder object.
-
createSession
Description copied from class:ContextCreate a session builder based on the properties defined on this context.Use this method for creating sessions where you want to override basic settings. Otherwise, use
Context.getSession()directly.- Overrides:
createSessionin classWriterSerializer- Returns:
- A new session builder.
-
getNamespaces
Default namespaces.- Returns:
- The default list of namespaces associated with this serializer.
- See Also:
-
getRdfBeanMeta
Description copied from interface:RdfMetaProviderReturns the language-specific metadata on the specified bean.- Specified by:
getRdfBeanMetain interfaceRdfMetaProvider- Parameters:
bm- The bean to return the metadata on.- Returns:
- The metadata.
-
getRdfBeanPropertyMeta
Description copied from interface:RdfMetaProviderReturns the language-specific metadata on the specified bean property.- Specified by:
getRdfBeanPropertyMetain interfaceRdfMetaProvider- Parameters:
bpm- The bean property to return the metadata on.- Returns:
- The metadata.
-
getRdfClassMeta
Description copied from interface:RdfMetaProviderReturns the language-specific metadata on the specified class.- Specified by:
getRdfClassMetain interfaceRdfMetaProvider- Parameters:
cm- The class to return the metadata on.- Returns:
- The metadata.
-
getSession
Description copied from class:ContextReturns a session to use for this context.Note that subclasses may opt to return a reusable non-modifiable session.
- Overrides:
getSessionin classWriterSerializer- Returns:
- A new session object.
-
getXmlBeanMeta
Description copied from interface:XmlMetaProviderReturns the language-specific metadata on the specified bean.- Specified by:
getXmlBeanMetain interfaceXmlMetaProvider- Parameters:
bm- The bean to return the metadata on.- Returns:
- The metadata.
-
getXmlBeanPropertyMeta
Description copied from interface:XmlMetaProviderReturns the language-specific metadata on the specified bean property.- Specified by:
getXmlBeanPropertyMetain interfaceXmlMetaProvider- Parameters:
bpm- The bean property to return the metadata on.- Returns:
- The metadata.
-
getXmlClassMeta
Description copied from interface:XmlMetaProviderReturns the language-specific metadata on the specified class.- Specified by:
getXmlClassMetain interfaceXmlMetaProvider- Parameters:
cm- The class to return the metadata on.- Returns:
- The metadata.
-
getCollectionFormat
RDF format for representing collections and arrays.- Returns:
- RDF format for representing collections and arrays.
- See Also:
-
getJenaSettings
All Jena-related configuration properties.- Returns:
- A map of all Jena-related configuration properties.
-
getJuneauBpNs
Default XML namespace for bean properties.- Returns:
- The XML namespace to use for bean properties.
- See Also:
-
getJuneauNs
XML namespace for Juneau properties.- Returns:
- The XML namespace to use for Juneau properties.
- See Also:
-
getLanguage
RDF language.- Returns:
- The RDF language to use.
- See Also:
-
isAddBeanTypes
Add"_type" properties when needed.- Overrides:
isAddBeanTypesin classSerializer- Returns:
true if"_type" properties will be added to beans if their type cannot be inferred through reflection.- See Also:
-
isAddLiteralTypes
Add XSI data types to non-String literals.- Returns:
true if XSI data types should be added to string literals.- See Also:
-
isAddRootProp
Add RDF root identifier property to root node.- Returns:
true if RDF propertyhttp://www.apache.org/juneau/root is added with a value of"true" to identify the root node in the graph.- See Also:
-
isAutoDetectNamespaces
Auto-detect namespace usage.- Returns:
true if namespaces usage should be detected before serialization.- See Also:
-
isLooseCollections
Collections should be serialized and parsed as loose collections.- Returns:
true if 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).- See Also:
-
isUseXmlNamespaces
Reuse XML namespaces when RDF namespaces not specified. -
properties
Description copied from class:ContextReturns the properties on this bean as a map for debugging.- Overrides:
propertiesin classWriterSerializer- Returns:
- The properties on this bean as a map for debugging.
-