Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Just use popular RDF namespace prefixes from prefix.cc

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 share
Octocat-spinner-32 t
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Changes
Octocat-spinner-32 README.md
Octocat-spinner-32 convertshare.pl
Octocat-spinner-32 dist.ini
Octocat-spinner-32 update.pl
README.md

Working with RDF data is cumbersome, unless you define namespaces and prefixes for abbreviation. Defining namespaces, however, is also cumbersome because you need to repeat this step in every environment. This is silly because in most cases we use the same URI namespaces anyway. Some popular examples:

@prefix owl: <http://www.w3.org/2002/07/owl#> .   (Turtle/N3)

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>   (SPARQL)

xmlns:foaf="http://xmlns.com/foaf/0.1/"   (RDF/XML)

Fortunately there is http://prefix.cc, a registry where people can vote the most popular URI namespaces. It is best practice to use the same prefixes as defined there. The Perl module RDF::NS contains regular snapshots from http://prefix.cc for easy reuse without having to download them in every application.

In short, you can get a full prefix-to-namespace mapping as blessed hash with

RDF::NS->new('20131205')

The only argument to the constructor is the version number, that is equivalent to the date of a particular snapshot. The changelog in the file Changes lists all snapshots with their modifications. RDF::NS provides some handy methods, for instance you can use method-calls to create full URIs:

$ns->rdf_type; # returns "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"

The subclass RDF::NS::Trine, shipped with RDF::NS returns blessed URI objects instead of plain strings, as expected by RDF::Trine. Please have a look at the documentation for more information.

The source code of RDF::NS is available at https://github.com/nichtich/RDF-NS/ with releases at http://search.cpan.org/dist/RDF-NS/.

Build Status Coverage Status

Something went wrong with that request. Please try again.