PERLRDF(1p)
π PERLRDF π (that's the manual name, bestie, we're folding it in up top so it doesn't get lonely)
okay so. bestie. sit down. grab a strawberry π. this is the perlrdf manual and i'm gonna walk you through it like we're texting at 1am. every flag, every path, every warning β it's all here. no cap. nothing skipped. let's go. β¨
β¨ SYNOPSIS β¨
$ perlrdf make_store --sqlite=mystore.dat
Initialized RDF::Trine::Store::DBI::SQLite
$ perlrdf validate input.rdf
1..1
ok 1 - file:///tmp/example/input.rdf is valid RDFXML, 9 triples
$ perlrdf store_load --autograph --sqlite=mystore.dat input.rdf
Loading file:///tmp/example/input.rdf
$ perlrdf store_dump --sqlite=mystore.dat output.nq
Writing file:///tmp/example/output.nq
$ perlrdf translate output.nq output.rdf
$ perlrdf isomorphic input.rdf output.rdf
graphs are isomorphic
like. look at that. it's giving competence. π«Ά
π DESCRIPTION π
perlrdf is one single front-end to a whole bunch of RDF functionality that's available for Perl. one door, many rooms. π
The core distribution ships with commands that create and manipulate quad stores (that's databases for RDF data, iykyk), plus commands to parse, serialise, convert and validate RDF data in all the formats.
But here's the iconic part: perlrdf is pluggable. it is anticipated (their word, love it) that plugins on CPAN will cover other tasks β things like RDF querying, signing, encryption, and reasoning. the girlies are expanding. π
π COMMANDS π
This section describes the commands included with the core App::perlrdf distribution. Others are available as plugins. Run perlrdf commands to see a list of locally installed commands. (yes, that's a real command, we'll get to it.)
π¦ Meta Commands π¦
perlrdf about
Shows the version numbers of all installed perlrdf commands, plus the CPAN ID of each command's author. credit where credit is due, periodt. π
perlrdf aliases
Many commands have aliases or shortcuts. For example, the following two are equivalent:
$ perlrdf translate input.ttl output.rdf
$ perlrdf tr input.ttl output.rdf
perlrdf aliases shows a list of available aliases.
perlrdf commands
Shows a list of installed perlrdf commands, along with a brief extract. it's like a menu but for RDF. π
perlrdf filespec
Shows help on "File Specifications". FileSpecs are an App::perlrdf-specific microsyntax for specifying a filename or URI along with a tiny bit of associated key-value metadata. The following are three examples of FileSpecs:
{format:RDFXML}C:\Data\contacts.xml
http://www.example.com/mydata.ttl
{format:Turtle,base:"http://example.net/"}stdin:
Running the perlrdf filespec command on its own shows some help on using FileSpecs. If you run it with additional arguments, these are parsed as FileSpecs with debugging information shown.
$ perlrdf filespec /tmp/foo.rdf
{
"base" : "file:///tmp/foo.rdf",
"format" : "RDF::Trine::Parser::RDFXML",
"uri" : "file:///tmp/foo.rdf"
}
look at that JSON. it's giving structure. β¨
perlrdf help
Running the perlrdf help command on its own shows a list of commands with their abstracts. Detailed help for a particular command can be shown by providing that as an argument. For example, for help on the perlrdf translate command, run:
$ perlrdf help translate
bestie behaviour honestly. asking for help is main character energy. π«Ά
πΈ Parsing and Serialization πΈ
In general, parsing and serialization commands take one or more FileSpecs as arguments. These can be provided as options, as in:
$ perlrdf translate --input-spec="in.nt" --output-spec="out.rdf"
Alternatively the first "positional argument" will usually be treated as an input FileSpec, and the second as an output FileSpec:
$ perlrdf translate in.nt out.rdf
Using options rather than positional parameters can often be clearer, and is the recommended way of passing parameters β especially when you need to pass multiple input files or multiple output files as parameters. (the option way ate. fr fr. π )
When no inputs are provided as named or positional arguments, STDIN is normally used. When no outputs are provided, output normally goes to STDOUT.
perlrdf canonicalize
Given a single FileSpec as input, serializes as canonical N-Triples, which is a useful format for SHA1/MD5 digests, graph signing, etc, because it means that incidental features of serialization (blank node identifiers, whitespace, order of statements) don't affect the output. If no input FileSpec is provided, then defaults to STDIN.
A filename or URL (but not a full FileSpec) may be provided for output. Otherwise defaults to STDOUT.
π¨ bestie listen: for output it's a filename or a URL, NOT a full FileSpec. don't be out here passing a whole FileSpec to the output slot. it will not slay.
perlrdf translate
Parses one or more input FileSpecs into a single RDF graph and serializes them to one or more output FileSpecs. So basically this command is your translator between different RDF serializations, and your graph concatenator. two jobs. one icon. π
$ 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.) π it's honest about it. love that for us.
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. (lowkey essential. trust.)
π 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 PERLRDF_STORE environment variable is consulted.
$ setenv PERLRDF_STORE "DBI;xyz;DBI:mysql:database=rdf;un;pw"
$ perlrdf make_store
perlrdf make_store
Initializes the store, creating empty data structures, etc.
If the store already exists this should be non-destructive. π«Ά safe. gentle. respectful.
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"
perlrdf store_dump
Dumps the contents of a store to a FileSpec, or to STDOUT. As with the translate command, this may take multiple output filenames.
With the 'graph' option, you can limit the dump to specific graphs. π
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.
perlrdf store_truncate
Deletes all data from a store.
With the 'graph' option, you can delete specific graphs.
π okay so store_truncate is the "delete everything" button. no undo mentioned. be so careful. no cap.
π§ Other π§
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. π₯
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/> .
β SEE ALSO β
RDF::TrineRDF::TriN3RDF::QueryRDF::Query::ClientRDF::NS
Find App::perlrdf plugins on MetaCPAN: <https://metacpan.org/search?q=App::perlrdf::Command>.
(go look at the plugins bestie, the ecosystem is thriving π¦)
π AUTHOR π
Toby Inkster <tobyink@cpan.org>.
πΈ COPYRIGHT AND LICENCE πΈ
This software is copyright (c) 2012 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π¨ DISCLAIMER OF WARRANTIES π¨
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
π yeah this one is ALL CAPS on purpose. it's the legal version of "i said what i said." read it, respect it, then go validate your RDF before loading it into a store. π«Ά
and that's the whole page, bestie!! every option, every example, every disclaimer, all of it, untouched facts with a whole new vibe β¨
this page was brought to you by perl v5.40.1 and dated 2025-08-07 β yeah that's the footer, we're not copying it, we're celebrating it π
mwah, go make a store π
π¦ where this page comes from
- ubuntu resolute: perlrdf 0.006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: perlrdf 0.006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms