NAME
RDF::TrineX::Parser::Pretdsl - the Perl RDF Extended Turtle Domain-Specific Language
DESCRIPTION
Pretdsl is a domain-specific language for describing Perl projects (in particular CPAN releases) in RDF triples. It can be seen as an enhanced version of Turtle/N3, or an application of ShorthandRDF.
About Pretdsl
Pretdsl is Notation 3, plus...
Predefined prefixes
The following prefixes are pre-declared (though you can explicitly declare them, or redeclare them to be something else if you prefer...)
# 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
Like how Turtle defines "a" as a term that expands to rdf:type, Pretdsl defines some terms:
# 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 .
XSD datatype shorthands
Like how Turtle has shorthands for literals of type xsd:integer, xsd:double and xsd:boolean, such that they don't need quoting or an explicit datatype, Pretdsl defines shorthands for xsd:date and xsd:dateTime.
For xsd:date, just use YYYY-MM-DD format. For xsd:dateTime, use YYYY-MM-DDThh:mm:ss.sss+zzzz (seconds must be included, but fractions of seconds are optional; timezones are optional, and 'Z' is supported for UTC).
Perl-specific datatype shorthands
Pretdsl defines a special quoting style for Perl-specific resources. A quoted resource starts and ends with a backtick (`). The first backtick may also be preceded by a single letter which is used 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`
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 mentioned above are intercepted during the parse, and being added to the model as literals, they are replaced with blank nodes and URIs, and enriched with additional triples.
So the following 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.
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=RDF-TriN3.
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.