juneau-marshall-rdf
| Maven | |
|---|---|
| Jar | juneau-marshall-rdf-10.0.0.jar |
| OSGi | org.apache.juneau.marshall-rdf_10.0.0.jar |
| Links | Maven Central · Javadocs · Source |
Contents/Features
The juneau-marshall-rdf library provides additional serializers and parsers for RDF.
These rely on the Apache Jena library to provide support for the following formats:
Text-based formats:
- RDF/XML
- RDF/XML-Abbrev
- RDF/JSON
- N-Triples (W3C)
- Turtle (W3C)
- N3 (Notation3)
- N-Quads
- TriG (Turtle with named graphs)
- TriX (XML-based)
- JSON-LD (W3C)
Binary formats:
- RDF/THRIFT (Apache Thrift encoding)
- RDF/PROTO (Protocol Buffers encoding)
See RDF Basics for full documentation.
When to use it
Add this module when you need to read or write RDF through the same Person.class style API as the other marshallers, without calling Jena directly.
Example
import org.apache.juneau.marshall.jena.marshaller.*;
public class RdfExample {
public static class Person {
public String name;
public int age;
public Person() {}
public Person(String name, int age) { this.name = name; this.age = age; }
}
public static void main(String[] args) throws Exception {
Person person = new Person("Alice", 30);
String turtle = Turtle.of(person);
Person restored = Turtle.to(turtle, Person.class);
System.out.println(restored.name + " " + restored.age);
}
}
Options
| Format | Marshaller |
|---|---|
| RDF/XML | RdfXml |
| Turtle | Turtle |
| N-Triples | NTriple |
| JSON-LD | JsonLd |
| RDF/THRIFT | RdfThrift |
| RDF/PROTO | RdfProto |
See also
In This Section
📄️ 2.3.1. RDF Basics
The org.apache.juneau.marshall.jena and
📄️ 2.3.2. RDF Serializers
The RDF serializers convert POJOs into RDF representations. The module provides both character-based serializers (text formats) and stream-based serializers (RDF/THRIFT and RDF/PROTO binary formats).
📄️ 2.3.3. RDF Parsers
The RDF parsers convert RDF input (text or binary) into POJOs. The module provides character-based parsers for all text RDF formats and stream-based parsers for RDF/THRIFT and RDF/PROTO binary formats.