Abbreviated URIs with rdfns

9. September 2014 um 11:26 Keine Kommentare

Working with RDF and URIs can be annoying because URIs such as „“ are long and difficult to remember and type. Most RDF serializations make use of namespace prefixes to abbreviate URIs, for instance „dc“ is frequently used to abbreviate „“ so „“ can be written as qualified name „dc:title„. This simplifies working with URIs, but someone still has to remember mappings between prefixes and namespaces. Luckily there is a registry of common mappings at

A few years ago I created the simple command line tool rdfns and a Perl library to look up URI namespace/prefix mappings. Meanwhile the program is also available as Debian and Ubuntu package librdf-ns-perl. The newest version (not included in Debian yet) also supports reverse lookup to abbreviate an URI to a qualified name. Features of rdfns include:

look up namespaces (as RDF/Turtle, RDF/XML, SPARQL…)

$ rdfns foaf.ttl foaf.xmlns dbpedia.sparql foaf.json

@prefix foaf:  .
PREFIX dbpedia: 
"foaf": ""

expand a qualified name

$ rdfns dc:title

lookup a preferred prefix

$ rdfns


create a short qualified name of an URL

$ rdfns


I use RDF-NS for all RDF processing to improve readability and to avoid typing long URIs. For instance Catmandu::RDF can be used to parse RDF into a very concise data structure:

$ catmandu convert RDF --file rdfdata.ttl to YAML

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.