Class RdfParser.Builder<SELF extends RdfParser.Builder<SELF>>

Direct Known Subclasses:
RdfParser.DefaultBuilder
Enclosing class:
RdfParser

public abstract static class RdfParser.Builder<SELF extends RdfParser.Builder<SELF>> extends ReaderParser.Builder<SELF>
Builder class.
  • Constructor Details

    • Builder

      protected Builder()
      Constructor, default settings.
    • Builder

      protected Builder(RdfParser.Builder<?> copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The builder to copy from.
      Cannot be null.
    • Builder

      protected Builder(RdfParser copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean to copy from.
      Cannot be null.
  • Method Details

    • build

      public RdfParser build()
      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class ReaderParser.Builder<SELF extends RdfParser.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.
      Parameters:
      value - The new value for this property.
      Cannot be null.
      Returns:
      This object.
    • copy

      public abstract SELF copy()
      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class ReaderParser.Builder<SELF extends RdfParser.Builder<SELF>>
      Returns:
      A new mutable copy of this builder.
    • hashKey

      public HashKey hashKey()
      Description copied from class: Context.Builder
      Returns the hashkey of this builder.

      Used to return previously instantiated context beans that have matching hashkeys. The HashKey object is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if the HashKey.equals(Object) method is the same.

      Overrides:
      hashKey in class ReaderParser.Builder<SELF extends RdfParser.Builder<SELF>>
      Returns:
      The hashkey of this builder.
    • juneauBpNs

      public SELF juneauBpNs(Namespace value)
      Default XML namespace for bean properties.
      Parameters:
      value - The new value for this property.
      The default is {j:'http://www.apache.org/juneaubp/'}.
      Cannot be null.
      Returns:
      This object.
    • juneauNs

      public SELF juneauNs(Namespace value)
      XML namespace for Juneau properties.
      Parameters:
      value - The new value for this property.
      The default is {j:'http://www.apache.org/juneau/'}.
      Cannot be null.
      Returns:
      This object.
    • language

      public SELF language(String value)
      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 property org.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 property.
      Cannot be null.
      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(); ReaderParser parser = RdfParser .create() .xml() .looseCollections() .build(); List<MyBean> list = createListOfMyBeans(); // Serialize to RDF/XML as loose resources String rdfXml = serializer.write(list); // Parse back into a Java collection list = parser.read(rdfXml, LinkedList.class, MyBean.class); MyBean[] bean = 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

      public SELF looseCollections(boolean value)
      Same as looseCollections() but explicitly specifies the setting value.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • n3

      public SELF 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

      public SELF n3_disableAbbrevBaseUri(boolean value)
      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

      public SELF n3_disableObjectLists(boolean value)
      N3/Turtle property: disableObjectLists.

      Don't print object lists as comma separated lists.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • n3_disableUseDoubles

      N3/Turtle property: disableUseDoubles.

      Disallow the use of doubles as 123.456.

      Returns:
      This object.
    • n3_disableUseDoubles

      public SELF n3_disableUseDoubles(boolean value)
      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

      public SELF n3_disableUsePropertySymbols(boolean value)
      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

      public SELF n3_disableUseTripleQuotedStrings(boolean value)
      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

      public SELF n3_indentProperty(int value)
      N3/Turtle property: indentProperty.

      Width to indent properties.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • n3_minGap

      public SELF n3_minGap(int value)
      N3/Turtle property: minGap.

      Minimum gap between items on a line.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • n3_propertyColumn

      public SELF n3_propertyColumn(int value)
      N3/Turtle property: propertyColumn.

      Width of the property column.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • n3_subjectColumn

      public SELF n3_subjectColumn(int value)
      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 property.
      Returns:
      This object.
    • n3_widePropertyLen

      public SELF n3_widePropertyLen(int value)
      N3/Turtle property: widePropertyLen.

      Width of the property column. Must be longer than propertyColumn.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • ntriple

      public SELF 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

      public SELF rdfxml_allowBadUris(boolean value)
      RDF/XML property: allowBadURIs.

      URIs in the graph are, by default, checked prior to serialization.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • rdfxml_attributeQuoteChar

      public SELF rdfxml_attributeQuoteChar(char value)
      RDF/XML property: attributeQuoteChar.

      The XML attribute quote character.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • rdfxml_blockRules

      public SELF rdfxml_blockRules(String value)
      RDF/XML property: blockRules.

      A list of Resource or a String 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 property.
      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 property.
      Returns:
      This object.
    • rdfxml_embedding

      RDF/XML ARP property: embedding.

      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

      public SELF rdfxml_embedding(boolean value)
      RDF/XML ARP property: embedding.

      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 property.
      Returns:
      This object.
    • rdfxml_errorMode

      public SELF rdfxml_errorMode(String value)
      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 property.
      Returns:
      This object.
    • rdfxml_iriRules

      public SELF rdfxml_iriRules(String value)
      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 property.
      Returns:
      This object.
    • rdfxml_longId

      public SELF 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

      public SELF rdfxml_longId(boolean value)
      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 property.
      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 property.
      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 an OutputStreamWriter that uses some encoding other than UTF-8 or UTF-16. In this case the encoding is shown in the XML declaration.
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • rdfxml_tab

      public SELF rdfxml_tab(int value)
      RDF/XML property: tab.

      The number of spaces with which to indent XML child elements.

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • rdfxml_xmlbase

      public SELF rdfxml_xmlbase(String value)
      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 property.
      Returns:
      This object.
    • trimWhitespace

      public SELF trimWhitespace()
      Trim whitespace from text elements.

      When enabled, whitespace in text elements will be automatically trimmed.

      Example:

      // Create an RDF parser that trims whitespace. ReaderParser parser = RdfParser .create() .xml() .trimWhitespace() .build();

      Returns:
      This object.
    • trimWhitespace

      public SELF trimWhitespace(boolean value)
      Same as trimWhitespace() but allows you to explicitly specify the value.
      Parameters:
      value - The new value for this setting.
      Returns:
      This object.
    • turtle

      public SELF turtle()
      Shortcut for calling language(LANG_TURTLE).
      Returns:
      This object.
    • jsonLd

      public SELF jsonLd()
      Shortcut for calling language(LANG_JSONLD).
      Returns:
      This object.
    • nQuads

      public SELF nQuads()
      Shortcut for calling language(LANG_NQUADS).
      Returns:
      This object.
    • triG

      public SELF triG()
      Shortcut for calling language(LANG_TRIG).
      Returns:
      This object.
    • triX

      public SELF triX()
      Shortcut for calling language(LANG_TRIX).
      Returns:
      This object.
    • rdfJson

      public SELF rdfJson()
      Shortcut for calling language(LANG_RDFJSON).
      Returns:
      This object.
    • xml

      public SELF xml()
      Shortcut for calling language(LANG_RDF_XML).
      Returns:
      This object.
    • xmlabbrev

      public SELF xmlabbrev()
      Shortcut for calling language(LANG_RDF_XML_ABBREV).
      Returns:
      This object.