Class N3Serializer

All Implemented Interfaces:
Function<Object,String>, ThrowingFunction<Object,String>, RdfMetaProvider, XmlMetaProvider

public class N3Serializer extends RdfSerializer
Subclass of RdfSerializer for serializing POJOs to N3 (Notation3) format.

Produces RDF in Notation3 syntax, a compact, readable format that extends Turtle with additional features such as formulas and variables.

Examples:

// Serialize a bean to N3 string. Person person = new Person("Alice", 30); String n3 = N3Serializer.DEFAULT.write(person);

// Or use the N3 marshaller for convenience. String n3 = N3.DEFAULT.write(person);

// Custom serializer with swaps. N3Serializer s = N3Serializer.create().swaps(DateSwap.class).build(); String n3 = s.write(bean);

Example output (bean with name/age):

@prefix j: <...> . <...> a j:Person ; j:name "Alice" ; j:age 30 .

Complex (nested address + array):

@prefix j: <...> . <...> a j:Person ; j:name "Alice" ; j:age 30 ; j:address <.../address> ; j:tags <.../tags> . <.../address> a j:Address ; j:street "123 Main St" ; j:city "Boston" ; j:state "MA" .

Notes:

  • This class is thread safe and reusable.

See Also:

  • Field Details

    • DEFAULT

      public static final N3Serializer DEFAULT
      Default N3 serializer, all default settings.
  • Constructor Details

  • Method Details