LinuxCommandLibrary

rapper

Convert between media container formats

TLDR

Convert an RDF/XML document to Turtle

$ rapper [[-i|--input]] rdfxml [[-o|--output]] turtle [path/to/file]
copy

Count the number of triples in a Turtle file
$ rapper [[-i|--input]] turtle [[-c|--count]] [path/to/file]
copy

SYNOPSIS

rapper [OPTIONS] FILE [BASE_URI]
FILE can be '-' to read from standard input.

PARAMETERS

--help, -h
    Show a summary of command-line options.

--version, -v
    Display the rapper program version.

--input FORMAT, -i FORMAT
    Specify the input RDF syntax format (e.g., rdfxml, turtle, n3, ntriples, json, guess).

--output FORMAT, -o FORMAT
    Specify the output RDF syntax format (e.g., rdfxml, turtle, n3, ntriples, json, dot, html).

--count, -c
    Count and print the number of triples parsed.

--generate-bnode-ids, -g
    Generate new blank node IDs during parsing.

--debug, -d
    Print debugging information for diagnostics.

--quiet, -q
    Suppress informational messages.

--warn, -w
    Print warning messages if issues are encountered.

--rdfs-rules, -r
    Apply RDFS inference rules to the parsed graph.

--model MODEL, -m MODEL
    Load RDF into a specific model type (e.g., memory, file, sqlite).

--namespaces, -N
    Print the namespaces defined in the input.

--lax, -L
    Relax parsing rules, attempting to recover from errors.

--input-uri URI, -I URI
    Set the base URI for resolving relative URIs in the input.

--output-uri URI, -O URI
    Set the base URI for resolving relative URIs in the output.

--canonical, -C
    Generate canonical output, typically N-Triples for unambiguous representation.

--allow-no-file, -a
    Allow rapper to operate without a specified input file, reading from stdin.

--error-messages-to-stderr, -e
    Direct error messages to standard error (default).

--sink-to-stdout, -s
    Direct parsed triples output to standard output (default).

--parser-feature FEATURE=VALUE, -P FEATURE=VALUE
    Set a specific parser feature with a value.

--serializer-feature FEATURE=VALUE, -S FEATURE=VALUE
    Set a specific serializer feature with a value.

--xml-declaration, -x
    Include an XML declaration in XML-based output formats.

DESCRIPTION

rapper is a versatile command-line utility used for parsing and serializing RDF (Resource Description Framework) data. It's a key component of the Redland RDF library, providing functionality to convert RDF data between various formats. Users can specify both input and output formats, making it invaluable for data interoperability and transformation tasks.

Beyond simple conversion, rapper offers features for syntax checking, counting triples, applying RDFS inference rules, and debugging. It supports a wide array of RDF syntaxes, including RDF/XML, Turtle, N-Triples, N3, JSON-LD, and more, enabling seamless integration with diverse RDF datasets. This tool is essential for developers and data architects working with semantic web technologies and linked data principles.

CAVEATS

Support for all possible RDF format variations and extensions may not be exhaustive, and malformed input can lead to parsing errors. Inference capabilities with --rdfs-rules are limited to RDFS and not full OWL.

INPUT/OUTPUT HANDLING

By default, rapper reads RDF from the specified FILE argument. If FILE is set to '-', it reads from standard input (stdin). Parsed and serialized output is sent to standard output (stdout), which can be redirected to a file or piped to another command. This allows for flexible integration into shell scripts and data processing pipelines.

SUPPORTED FORMATS

rapper supports a wide array of RDF serialization formats for both input and output. Common input formats include rdfxml, n3, turtle, ntriples, json (for JSON-LD), atom, and rss-1.0. Output formats similarly cover rdfxml, n3, turtle, ntriples, json, dot (for Graphviz), and html. The guess format can be used for input to automatically detect the format based on content and file extension.

HISTORY

rapper is part of the Redland RDF Application Framework, developed primarily by Dave Beckett since 2000. It serves as a foundational command-line utility for interacting with RDF data, leveraging the underlying Raptor RDF Parser Library and Rasqal RDF Query Library (both also part of Redland). Its development has tracked the evolution of RDF standards, offering a robust and flexible tool for RDF data manipulation and transformation within the Semantic Web ecosystem.

SEE ALSO

librdf(3), redland(3), rasqal(3)

Copied to clipboard