|
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
com.hp.hpl.jena.util.FileManager 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.
author: Ian Dickinson, HP Labs (email) version: Release @release@ ($Id: rdfcat.java,v 1.15 2008/01/02 12:08:16 andy_seaborne Exp $) |