RDF::T...tleSoup(3pm)
π RDF::T...tleSoup(3pm) β the whole vibe π
User Contributed Perl Documentation Β· RDF::TrineX::Serializer::MockTurtleSoup
β¨ NAME β¨
RDF::TrineX::Serializer::MockTurtleSoup β he's a bit slow, but he's sure good lookin' π«Ά
πΈ SYNOPSIS πΈ
use RDF::TrineX::Serializer::MockTurtleSoup;
my $ser = "RDF::TrineX::Serializer::MockTurtleSoup"->new(%opts);
$ser->serialize_model_to_file($fh, $model);
π¦ DESCRIPTION π¦
Okay so bestie, picture RDF::Trine::Serializer::Turtleβ¦ but real pretty. π
And slower. π
And it probably breaks with some complex graphs. π
π What's so pretty?
- Output interesting data first. Output URIs before bnodes. Output
rdf:typeandrdfs:labelbefore other predicates. And you get to define your own criteria for what nodes count as "interesting". π - Use QNames for predicates, classes and datatypes, use full URIs everywhere else. But also β and this is the slay part β you can hand it a list of extra URIs that should get abbreviated to QNames:
"RDF::TrineX::Serializer::MockTurtleSoup"->new(
abbreviate => [
qr{^http://ontologi\.es/},
qr{^http://purl\.org/},
"http://www.google.com/",
],
);
- Generate those QNames using RDF::Prefixes because it generates awesome prefixes. (Better than
"ns1","ns2", etc. fr fr.) - When data is equally interesting, sort alphabetically by subject, predicate and object. And when sorting by predicate, sort by the predicate's QName, not its full URI. iykyk.
- Compact Turtle list syntax (mostly stolen from Greg's
RDF::Trine::Serializer::Turtle) π - Inline simple bnodes.
- Indent nicely. β¨
β Options
The constructor supports the following options:
"abbreviate"β This option gets used as the right-hand side of a smart match to test URIs and see if they should be abbreviated to QNames.
URIs used as predicates or as the object of rdf:type triples are always abbreviated anyway. And URIs which can't be abbreviated to a legal QName just get output as URIs, no drama.
"apostrophe"β Boolean. If it's true, the serializer will sometimes quote literals with an apostrophe instead of double-quote marks. Recent versions of the Turtle spec allow this, but earlier specifications disallowed it, and it's not widely supported yet. Defaults tofalse."colspace"β This lets your predicate-object pairs line up as nice little columns. π The smaller the number, the closer they get. Default is20."encoding"β Either"ascii"or"utf8". Default is"utf8". π"indent"β A whitespace string to indent by. The default is one tab character. (God's chosen indentation. periodt.)"labelling"β This option gets used as the right-hand side of a smart match to decide which URIs are considered equivalent to"rdfs:label". The default is justhttp://www.w3.org/2000/01/rdf-schema#label."namespaces"β A hashref of prefix => URI pairs, to define your preferred QName prefixes. There's no guarantee these will be honoured, but they usually will be.RDF::Prefixesdoes a damn good job without any help, so honestly this is generally pretty unnecessary."priorities"β If defined, must be a coderef. The coderef gets called with these arguments: the serializer object itself, a node, and theRDF::Trine::Modelbeing serialized.
The coderef can use data inside the model to work out how "interesting" the node is. High numbers are very interesting. Negative numbers are very boring.
Interesting nodes are more likely to show up earlier in the output.
Default is undef.
"repeats"β Boolean. If false (which is the default), it'll output data like:
<http://example.com/>
dc:title "Cat"@en, "Chat"@fr.
If true, it'll output data like:
<http://example.com/>
dc:title "Cat"@en;
dc:title "Chat"@fr.
π§ Methods
This module provides the same API as RDF::Trine::Serializer. π«Ά
π BUGS π
Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=RDF-TrineX-Serializer-MockTurtleSoup>. π
π SEE ALSO π
RDF::Trine::Serializer::Turtle.
π AUTHOR π
Toby Inkster <tobyink@cpan.org>.
πΈ COPYRIGHT AND LICENCE πΈ
This software is copyright (c) 2013 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.
okay that's the whole page bestie, no cap π«Ά This one's from perl v5.34.0, dated 2022-06-17, and it's the RDF::T...tleSoup(3pm) page β love that for us. π β¨πΈ
π¦ where this page comes from
- debian bookworm: librdf-trinex-serializer-mockturtlesoup-perl 0.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trinex-serializer-mockturtlesoup-perl 0.006-2 Β· 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