Skip to content

Latest commit

 

History

History
129 lines (126 loc) · 12.5 KB

SesameRdfFormatter.md

File metadata and controls

129 lines (126 loc) · 12.5 KB

usage: org.edmcouncil.rdf_toolkit.SesameRdfFormatter

 -bi,--base-iri <arg>                    set IRI to use as base URI
 -dtd,--use-dtd-subset                   for XML, use a DTD subset in
                                         order to allow prefix-based IRI
                                         shortening
 -h,--help                               print out details of the
                                         command-line arguments for the
                                         program
 -i,--indent <arg>                       sets the indent string.  Default
                                         is a single tab character
 -ibi,--infer-base-iri                   use the OWL ontology IRI as the
                                         base URI.  Ignored if an explicit
                                         base IRI has been set
 -ibn,--inline-blank-nodes               use inline representation for
                                         blank nodes.  NOTE: this will
                                         fail if there are any recursive
                                         relationships involving blank
                                         nodes.  Usually OWL has no such
                                         recursion involving blank nodes.
                                         It also will fail if any blank
                                         nodes are a triple subject but
                                         not a triple object.
 -ip,--iri-pattern <arg>                 set a pattern to replace in all
                                         IRIs (used together with
                                         --iri-replacement)
 -ir,--iri-replacement <arg>             set replacement text used to
                                         replace a matching pattern in all
                                         IRIs (used together with
                                         --iri-pattern)
 -lc,--leading-comment <arg>             sets the text of the leading
                                         comment in the ontology.  Can be
                                         repeated for a multi-line comment
 -osl,--override-string-language <arg>   sets an override language that is
                                         applied to all strings
 -s,--source <arg>                       source (input) RDF file to format
 -sd,--source-directory <arg>            source (input) directory of RDF
                                         files to format.  This is a
                                         directory processing option
 -sdp,--source-directory-pattern <arg>   relative file path pattern
                                         (regular expression) used to
                                         select files to format in the
                                         source directory.  This is a
                                         directory processing option
 -sdt,--string-data-typing <arg>         sets whether string data values
                                         have explicit data types, or not;
                                         one of: explicit, implicit
                                         [default]
 -sfmt,--source-format <arg>             source (input) RDF format; one
                                         of: auto (select by filename)
                                         [default], binary, json-ld
                                         (JSON-LD), n3, n-quads (N-quads),
                                         n-triples (N-triples), rdf-a
                                         (RDF/A), rdf-json (RDF/JSON),
                                         rdf-xml (RDF/XML), trig (TriG),
                                         trix (TriX), turtle (Turtle)
 -sip,--short-iri-priority <arg>         set what takes priority when
                                         shortening IRIs: prefix
                                         [default], base-iri
 -t,--target <arg>                       target (output) RDF file
 -tc,--trailing-comment <arg>            sets the text of the trailing
                                         comment in the ontology.  Can be
                                         repeated for a multi-line comment
 -td,--target-directory <arg>            target (output) directory for
                                         formatted RDF files.  This is a
                                         directory processing option
 -tdp,--target-directory-pattern <arg>   relative file path pattern
                                         (regular expression) used to
                                         construct file paths within the
                                         target directory.  This is a
                                         directory processing option
 -tfmt,--target-format <arg>             target (output) RDF format: one
                                         of: json-ld (JSON-LD), rdf-xml
                                         (RDF/XML), turtle (Turtle)
                                         [default]
 -v,--version                            print out version details

Examples:

  1. Print out command-line help
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --help
  1. Print out the RDF Toolkit version
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --version
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl)
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), using the default source/target formats (Turtle for both)
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), using the given base URI for the output Turtle
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl --base-iri http://www.example.com/my-base-iri
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), using the given base URI for the output Turtle, and use the base URI in preference to prefixes for URL shortening
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl --base-iri http://www.example.com/my-base-iri --short-iri-priority base-iri
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), with inline blank nodes (note: assumes no recursive relationships between blank nodes; this is usually the case for OWL)
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl --inline-blank-nodes
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), with the OWL ontology URI used as the base URI
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl --infer-base-iri
  1. Format a Turtle file (input.ttl) as sorted RDF/XML (output.rdf), using entity references for URL shortening
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.rdf --target-format rdf-xml --use-dtd-subset
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), with a leading and a trailing comment
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle --leading-comment "Start of my ontology" --trailing-comment "End of my ontology"
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), with a multi-line leading and a trailing comments
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle -lc "Start of my ontology" -lc "Version 1" -tc "End of my ontology" -tc "Version 1"
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl) with explicit data typing for strings
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle --string-data-typing explicit
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl) with two spaces as the indent string
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle --indent " "
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening and inline blank nodes (note: assumes no recursive relationships between blank nodes; this is usually the case for OWL)
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset --inline-blank-nodes
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening, with the OWL ontology URI used as the base URI
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset --infer-base-iri
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl), using the default source/target formats (Turtle for both), and replacing 'www.example.com' in URIs with 'www.example.org'
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --target output.ttl --iri-pattern www.example.com --iri-replacement www.example.org
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening, with a leading and a trailing comment
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset --leading-comment "Start of my ontology" --trailing-comment "End of my ontology"
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening, with a multi-line leading and a trailing comments
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset -lc "Start of my ontology" -lc "Version 1" -tc "End of my ontology" -tc "Version 1"
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening and with explicit data typing for strings
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset --string-data-typing explicit
  1. Format an RDF/XML file (input.rdf) as sorted RDF/XML (output.rdf), using entity references for URL shortening and with two spaces as the indent string
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.rdf --source-format rdf-xml --target output.rdf --target-format rdf-xml --use-dtd-subset --indent " "
  1. Format a RDF/XML file (input.rdf) as sorted JSON-LD (output.jsonld), using the standard input & standard output
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source-format rdf-xml --target-format json-ld < input.rdf > output.jsonld
  1. Format all of the Turtle files in a directory tree into RDF/XML, preserving the relative directory structure.
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source-directory src/test/resources --source-directory-pattern '^(.*)\.ttl$' --source-format turtle --target-directory target/temp --target-directory-pattern '$1.rdf' --target-format rdf-xml
  1. Format a Turtle file (input.ttl) as sorted Turtle (output.ttl) with all strings given the nominated language.
  • java -cp rdf-toolkit.jar org.edmcouncil.rdf_toolkit.SesameRdfFormatter --source input.ttl --source-format turtle --target output.ttl --target-format turtle --override-string-language en-us