public class rdfcat extends Object
An RDF utility that takes its name from the Unix utility cat, and
is used to generate serialisations of the contents of zero or more
input model serialisations. Note In a change from previous
versions, but to ensure compatability with standard argument handling
practice, the input language options are no longer sticky. In
previous versions, rdfcat -n A B C
would ensure that A, B
and C were all read as N3. From Jena 2.5.2 onwards, this requires:
rdfcat -n A -n B -n C
, or the use of the -in
option.
Synopsis:
java jena.rdfcat (options|input)* where options are: -out N3 (aliases n, n3, ttl) -out N-TRIPLE (aliases t, ntriple) -out RDF/XML (aliases x, rdf, xml, rdfxml) -out RDF/XML-ABBREV (default) -in N3 (aliases n, n3, ttl) -in N-TRIPLE (aliases t, ntriple) -in RDF/XML (aliases x, rdf, xml, rdfxml) -include -noinclude (default) input is one of: -n <filename> for n3 input (aliases -n3, -N3, -ttl) -x <filename> for rdf/xml input (aliases -rdf, -xml, -rdfxml) -t <filename> for n-triple input (aliases -ntriple) or just a URL, a filename, or - for the standard input.
The default input language is RDF/XML, but the reader will try to guess the input language based on the file extension (e.g. N3 for file with a .n3 file extension.
The input language options set the language for the following file name only. So in the following example, input A is read as N3, inputs B, C and D are read as RDF/XML, while stdin is read as N-TRIPLE:
java jena.rdfcat -n A B C -t - -x D
To change the default input language for all files that do
not have a specified language encoding, use the -in
option.
If the include
option is set, the input files are scanned
for rdfs:seeAlso
and owl:imports
statements, and
the objects of these statements are read as well. By default, include
is off. If include
is turned on, the normal behaviour is for
the including statements (e.g owl:imports
to be filtered
from the output models. To leave such statements in place, use the --nofilter
option.
rdfcat uses the Jena FileManager
to resolve input URI's to locations. This allows, for example, http:
URI's to be re-directed to local file:
locations, to avoid a
network transaction.
Examples:
Join two RDF/XML files together into a single model in RDF/XML-ABBREV: java jena.rdfcat in1 in2 > out.rdf Convert a single RDF/XML file to N3: java jena.rdfcat in1 -out N3 > out.n3 Join two owl files one N3, one XML, and their imports, into a single NTRIPLE file: java jena.rdfcat -out NTRIPLE -include in1.owl -n in2.owl > out.ntriple Concatenate two N3-serving http URL's as N-TRIPLE java jena.rdfcat -in N3 -out N-TRIPLE http://example.com/a http://example.com/b
Note that, in a difference from the Unix utility cat
, the order
of input statements is not preserved. The output document is a merge of the
input documents, and does not preserve any statement ordering from the input
serialisations. Also, duplicate triples will be suppressed.
Modifier and Type | Field and Description |
---|---|
jena.cmdline.ArgDecl |
HELP
Argument to show usage
|
jena.cmdline.ArgDecl |
IN_LANG
Argument to set the default input language
|
jena.cmdline.ArgDecl |
IN_N3
Argument setting expected input language to N3
|
jena.cmdline.ArgDecl |
IN_NTRIPLE
Argument setting expected input language to NTRIPLE
|
jena.cmdline.ArgDecl |
IN_RDF_XML
Argument setting expected input language to RDF/XML
|
jena.cmdline.ArgDecl |
INCLUDE
Argument to turn include processing on
|
jena.cmdline.ArgDecl |
NOFILTER
Argument to leave import/seeAlso statements in place in flattened models
|
jena.cmdline.ArgDecl |
NOINCLUDE
Argument to turn include processing off
|
jena.cmdline.ArgDecl |
OUT_LANG
Argument to set the output language
|
static Map<String,String> |
unabbreviate
Map from abbreviated names to full names.
|
jena.cmdline.ArgDecl |
USAGE |
Constructor and Description |
---|
rdfcat() |
Modifier and Type | Method and Description |
---|---|
static String |
getCheckedLanguage(String shortLang)
Answer the full, checked, language name expanded from
shortName . |
static void |
main(String... args) |
public final jena.cmdline.ArgDecl IN_N3
public final jena.cmdline.ArgDecl IN_RDF_XML
public final jena.cmdline.ArgDecl IN_NTRIPLE
public final jena.cmdline.ArgDecl OUT_LANG
public final jena.cmdline.ArgDecl IN_LANG
public final jena.cmdline.ArgDecl INCLUDE
public final jena.cmdline.ArgDecl NOINCLUDE
public final jena.cmdline.ArgDecl NOFILTER
public final jena.cmdline.ArgDecl HELP
public final jena.cmdline.ArgDecl USAGE
public static void main(String... args)
public static String getCheckedLanguage(String shortLang)
shortName
.
The shortName is expanded according to the table of abbreviations [below].
It is then checked against RDFWriterFImpl's writer table [this is hacky but
at the moment it's the most available interface] and the NoWriter exception
trapped and replaced by the original IllegalArgument exception.Licenced under the Apache License, Version 2.0