App-perlrdf
view release on metacpan or search on metacpan
bin/perlrdf view on Meta::CPAN
Otherwise defaults to STDOUT.
=head3 C<< perlrdf translate >>
Parses one or more input FileSpecs into a single RDF graph and serializes
them to one or more output FileSpecs. Thus this command can be used as a
translator between different RDF serializations, and also as a graph
concatenator.
$ perlrdf translate \
--skolem \
-i "{format:RDFXML}/tmp/contacts.xml" \
-i "http://www.example.com/employees.ttl" \
-o "merged-contacts.nt" \
-o "merged-contacts.rdf"
The 'skolem' option allows you to generate URIs for any blank nodes in the
graph. (Not especially fantastic URIs, but URIs all the same.)
=head3 C<< perlrdf validate >>
Parses one or more input FileSpecs (doing nothing with the results), and
makes sure that each file parses without croaking. Writes output to STDOUT
in TAP format.
$ perlrdf validate "foo.ttl" "ftp://acme.example.com/pub/bar.rdf"
It's often a good idea to validate RDF before attempting to load it into a
store.
=head2 Quad Store Management
RDF::Trine stores can be connected to using DSN-like configuration strings
such as:
DBI;mymodel;DBI:mysql:database=rdf;user;password
These configuration strings are passed to the App::perlrdf tool using the
'store' option:
$ perlrdf make_store \
--store="DBI;mymodel;DBI:mysql:database=rdf;user;password"
For the common case of DBI-backed stores, App::perlrdf offers the ability
to avoid configuration strings and just specify database type, name, etc:
$ perlrdf make_store \
--database=mysql \
--dbname=rdf \
--username=user \
--password=password \
--model=contacts_db
SQLite-backed stores are particularly easy to work with:
$ perlrdf make_store --sqlite=/tmp/mydatabase.sqlite
If no store is specified on the command line, the C<PERLRDF_STORE>
environment variable is consulted.
$ setenv PERLRDF_STORE "DBI;xyz;DBI:mysql:database=rdf;un;pw"
$ perlrdf make_store
=head3 C<< perlrdf make_store >>
Initializes the store, creating empty data structures, etc.
If the store already exists this I<should> be non-destructive.
=head3 C<< perlrdf store_describe >>
Describes a resource in the database.
$ perlrdf store_describe --sqlite=/tmp/mydatabase.sqlite \
--output-format=RDFXML \
"http://www.example.com/id/alice"
=head3 C<< perlrdf store_dump >>
Dumps the contents of a store to a FileSpec, or to STDOUT. As with the
C<translate> command, this may take multiple output filenames.
With the 'graph' option, you can limit the dump to specific graphs.
=head3 C<< perlrdf store_load >>
Loads one or more FileSpecs into the store. By default, data is loaded as
triples (in no graph). You can specify a graph URI for the data using the
'graph' option; or use the 'autograph' option to indicate that you wish to
use the FileSpec URIs as graph URIs.
=head3 C<< perlrdf store_truncate >>
Deletes all data from a store.
With the 'graph' option, you can delete specific graphs.
=head2 Other
=head3 C<< perlrdf isomorphic >>
Given two input FileSpecs, checks whether they are isomorphic (i.e. the same
graph after mapping blank node identifiers). If they are non-isomorphic, it
will also inform you about them differing in "interesting" ways - i.e. one
graph being an exact subgraph of the other.
=head3 C<< perlrdf prefix >>
Looks up one or more prefixes using RDF::NS.
$ perlrdf prefix rdf,rdfs,owl,xsd
owl http://www.w3.org/2002/07/owl#
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs http://www.w3.org/2000/01/rdf-schema#
xsd http://www.w3.org/2001/XMLSchema#
$ perlrdf prefix --format=turtle foaf,dc
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
=head1 SEE ALSO
( run in 0.773 second using v1.01-cache-2.11-cpan-524268b4103 )