RDF::T...retdsl(3pm)
π¦ NAME π¦
okay bestie, welcome to RDF::TrineX::Parser::Pretdsl β that's the Perl RDF Extended Turtle Domain-Specific Language β¨ (it lives in the User Contributed Perl Documentation, section 3pm, and you're gonna be obsessed).
πΈ DESCRIPTION πΈ
So Pretdsl is a domain-specific language for describing Perl projects β especially CPAN releases β in RDF triples. Think of it as Turtle/N3 but with a glow-up, or honestly just an application of ShorthandRDF. π
π About Pretdsl π
Pretdsl is Notation 3, plus... (yes, the ellipsis is load-bearing, keep reading)
β¨ Predefined prefixes
These prefixes are pre-declared. You can explicitly declare them, or redeclare them to be something else if that's the vibe you're going for β no judgement, bestie π«Ά
# RDFa 1.1 prefixes
@prefix grddl: <http://www.w3.org/2003/g/data-view#> .
@prefix ma: <http://www.w3.org/ns/ma-ont#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rif: <http://www.w3.org/2007/rif#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix wdr: <http://www.w3.org/2007/05/powder#> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix wdrs: <http://www.w3.org/2007/05/powder-s#> .
@prefix xhv: <http://www.w3.org/1999/xhtml/vocab#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix ctag: <http://commontag.org/ns#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix ical: <http://www.w3.org/2002/12/cal/icaltzd#> .
@prefix og: <http://ogp.me/ns#> .
@prefix rev: <http://purl.org/stuff/rev#> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix v: <http://rdf.data-vocabulary.org/#> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix schema: <http://schema.org/> .
# Additional useful vocabularies
@prefix cpant: <http://purl.org/NET/cpan-uri/terms#>.
@prefix dbug: <http://ontologi.es/doap-bugs#> .
@prefix dcs: <http://ontologi.es/doap-changeset#> .
@prefix deps: <http://ontologi.es/doap-deps#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix earl: <http://www.w3.org/ns/earl#> .
@prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
@prefix pretdsl: <http://ontologi.es/pretdsl#> .
@prefix pretdsl-dt: <http://ontologi.es/pretdsl#dt/> .
π Predefined terms
Exactly like how Turtle defines a as a term that expands to rdf:type, Pretdsl defines some terms of its own. Iconic behaviour honestly:
# Generally useful predicates
@term label rdfs:label .
@term comment rdfs:comment .
@term seealso rdfs:seeAlso .
# Makefile predicates
@term abstract_from cpant:abstract_from .
@term author_from cpant:author_from .
@term license_from cpant:license_from .
@term requires_from cpant:requires_from .
@term perl_version_from cpant:perl_version_from .
@term version_from cpant:version_from .
@term readme_from cpant:readme_from .
@term no_index cpant:no_index .
@term install_script cpant:install_script .
@term requires cpant:requires .
@term requires_external_bin cpant:requires_external_bin .
@term recommends cpant:recommends .
@term test_requires cpant:test_requires .
@term configure_requires cpant:configure_requires .
@term build_requires cpant:build_requires .
@term provides cpant:provides .
# Changelog predicates
@term issued dc:issued .
@term changeset dcs:changeset .
@term item dcs:item .
@term versus dcs:versus .
# Changelog datatypes
@term Addition pretdsl-dt:Addition .
@term BackCompat pretdsl-dt:BackCompat .
@term Bugfix pretdsl-dt:Bugfix .
@term Change pretdsl-dt:Change .
@term Documentation pretdsl-dt:Documentation .
@term Packaging pretdsl-dt:Packaging .
@term Regresion pretdsl-dt:Regression .
@term Removal pretdsl-dt:Removal .
@term SecurityFix pretdsl-dt:SecurityFix .
@term SecurityRegression pretdsl-dt:SecurityRegression .
@term Tests pretdsl-dt:Tests .
@term Update pretdsl-dt:Update .
π«Ά yes, the changelog datatype is literally spelled Regresion up there. Type it exactly like that, bestie. character for character. no cap.
π XSD datatype shorthands
Turtle has shorthands for literals of type xsd:integer, xsd:double and xsd:boolean, so they don't need quoting or an explicit datatype. Pretdsl does the same thing but for xsd:date and xsd:dateTime β glow-up behaviour. β¨
For xsd:date, you just write the YYYY-MM-DD format. For xsd:dateTime, use YYYY-MM-DDThh:mm:ss.sss+zzzz β seconds must be included, fractions of seconds are optional, timezones are optional, and Z is supported for UTC.
π Perl-specific datatype shorthands
Pretdsl has a special quoting style for Perl-specific resources π . A quoted resource starts and ends with a backtick (<code>`</code>). The first backtick may also be preceded by a single letter, which is there for disambiguation.
Distributions:
`HTML-HTML5-Parser`
d`HTML-HTML5-Parser`
Releases:
`HTML-HTML5-Parser 0.200`
`HTML-HTML5-Parser 0.200 cpan:TOBYINK`
r`HTML-HTML5-Parser 0.200`
r`HTML-HTML5-Parser 0.200 cpan:TOBYINK`
Files:
`./README` # needs to contain a slash to disambiguate
`xt/test.pod` # with distributions
f`README` # or use explicit disambiguating letter
# Files may be qualified with a release...
f`README HTML-HTML5-Parser 0.200 cpan:TOBYINK`
Modules:
`HTML::HTML5::Parser`
# The following are semantically identical
m`HTML::HTML5::Parser`
f`lib/HTML/HTML5/Parser.pm`
# And so this is fine too...
m`HTML::HTML5::Parser HTML-HTML5-Parser 0.200 cpan:TOBYINK`
# Trailing "::" can disambiguate
`JSON::`
Packages:
# Always need the disambiguation letter to avoid confusion
# with modules
p`HTML::HTML5::Parser`
ngl, the line between packages and modules is a little blurred π. Future versions of Pretdsl may also provide datatype shorthands for classes and roles (in the Moose/Mouse sense).
CPAN IDs:
# It looks like a qname, but it's not. It's a case-insensitive
# literal shorthand
cpan:TOBYINK
cpan:tobyink
RT Bugs:
# No the hash below doesn't start a comment.
RT#12345
π₯ The Switch-a-Roo
All the Perl-specific datatypes, plus the changelog datatypes we mentioned above, get intercepted during the parse. Instead of being added to the model as literals, they get replaced with blank nodes and URIs, and enriched with additional triples. it's giving main character energy fr fr.
So this Pretdsl, which appears to have a literal subject:
`Example-Distribution 0.001 cpan:TOBYINK`
issued 2012-06-18 .
May be equivalent to the following Turtle:
<http://purl.org/NET/cpan-uri/dist/Example-Distribution/v_0-001>
a doap:Version ;
dcterms:identifier "Example-Distribution-0.001"^^xsd:string ;
doap:revision "0.001"^^xsd:string ;
dcs:released-by cpan:tobyink ;
doap:file-release <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Example-Distribution-0.001.tar.gz> ;
dcterms:issued "2012-06-18"^^xsd:date .
<http://purl.org/NET/cpan-uri/dist/Example-Distribution/project>
doap:release <http://purl.org/NET/cpan-uri/dist/Example-Distribution/v_0-001> .
π§ About the Parser π§
The parser provides the same API as RDF::Trine::Parser::Notation3. slay. π
π BUGS π
Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=RDF-TriN3>. (bestie do it, it's literally one link π)
π SEE ALSO π
RDF::Trine::Parser::NTriples, RDF::Trine::Parser::Turtle, RDF::Trine::Parser::Notation3, RDF::Trine::Parser::ShorthandRDF.
Module::Install::RDF, Module::Install::DOAP, Module::Install::DOAPChangeSets, Module::Package::RDF.
π AUTHOR π
Toby Inkster <tobyink@cpan.org>.
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2012 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.
and that's the whole page, bestie π β¨ this beauty dropped on 2022-06-17 and ships with perl v5.34.0 β go forth and describe your CPAN releases in style, you absolute icon π¦πΈπ«Ά
π¦ where this page comes from
- debian bookworm: librdf-trin3-perl 0.206-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trin3-perl 0.206-3 Β· 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