Notation 3 support
Toby Inkster
mail at tobyinkster.co.uk
Sun Jul 4 23:18:57 CEST 2010
On Fri, 02 Jul 2010 17:15:37 +0100
Toby Inkster <mail at tobyinkster.co.uk> wrote:
> It does not currently support property paths, though maybe this will
> be added later.
I woke up this morning with a clear idea of how to add support for
property paths. Implemented it this evening in less than 20 lines of
code. The attached patch should now be able to parse Notation 3 fully.
Next steps are an N3 serialiser, and then to clean it all up and release
it all as a separate distribution on CPAN. (I plan on calling it
"RDF::TriN3".)
In the mean time, here's a Turtle serialisation bugette I've discovered.
Create an RDF graph along these lines:
_:foo <#a> <#b> .
<#c> _:foo <#d> .
It will be serialised something like this:
[] <#a> <#b> .
<#c> _:r1234567890 <#d> .
Putting aside the fact that the second triple shouldn't be serialised
in Turtle at all, as it's not legal RDF, the serialiser has lost the
connection between the two appearances of the blank node.
I imagine when it decides to use '[]' rather than '_:something' to
serialise a blank node, it first checks whether the node is the object
of any triples - it doesn't check whether it's the predicate.
There's a slightly bigger option of what to do when a serialiser tries
to serialise a triple that cannot legally be represented in the format
its outputting. I'd suggest there should be a constructor option along
the lines of:
$s = RDF::Trine::Serializer->new('turtle', illegals=>'die');
Where 'illegals' can be set to 'die', 'warn', 'skip' or 'force'. If
'die' the serializer just dies when serialising something illegal; if
'warn' it issues a warning to STDERR and then skips the triple; if
'skip' it silently skips the triple; if 'force' it attempts to
serialise the triple even if it means that the output is not strictly
valid.
--
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RDF-Trine-n3model.patch
Type: text/x-patch
Size: 20089 bytes
Desc: not available
URL: <http://lists.perlrdf.org/pipermail/dev/attachments/20100704/185478bf/attachment.bin>
More information about the Dev
mailing list