NAME
RDF::Trine::Parser::ShorthandRDF - Shorthand RDF Parser
SYNOPSIS
use RDF::Trine::Parser;
my $parser = RDF::Trine::Parser->new( 'ShorthandRDF' );
$parser->parse_into_model( $base_uri, $data, $model );
DESCRIPTION
ShorthandRDF is an extension of N3 syntax. It defines a couple of extra "at rules".
@namepattern
Like @prefix
this specifies that particular tokens should be expanded through the addition of a URI prefix. However rather than defining a QName prefix for these tokens, a regular expression for them is defined.
@namepattern "\d{1,2}[A-Z][a-z]{2}\d{4}" <http://example.net/days/> .
<#someEvent> <#onDay> 6Apr2008 .
Is equivalent to the following Turtle:
<#someEvent> <#onDay> <http://example.net/days/6Apr2008> .
@datatype
Similar to @namepattern
, but produces a datatyped literal instead.
@datatype "\d{1,2}[A-Z][a-z]{2}\d{4}" <http://example.net/day> .
<#someEvent> <#onDay> 6Apr2008 .
Is equivalent to the following Turtle:
<#someEvent> <#onDay> "6Apr2008"^^<http://example.net/day> .
Precedence
In the case of multiple @namepattern
or @datatype
definitions that match the same token, the earlier definition wins.
METHODS
This package exposes the same methods as RDF::Trine::Parser::Notation3.
SEE ALSO
http://esw.w3.org/ShorthandRDF .
AUTHOR
Toby Inkster <tobyink@cpan.org>
Based on RDF::Trine::Parser::Turtle by Gregory Todd Williams.
COPYRIGHT
Copyright (c) 2006-2010 Gregory Todd Williams.
Copyright (c) 2010 Toby Inkster.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.