NAME¶
RDF::aREF::Decoder - decode another RDF Encoding Form (to RDF triples)
SYNOPSIS¶
use RDF::aREF::Decoder;
RDF::aREF::Decoder->new( %options )->decode( $aref );
DESCRIPTION¶
This module implements a decoder from another RDF Encoding Form (aREF), given as
in form of Perl arrays, hashes, and Unicode strings, to RDF triples.
OPTIONS¶
A default namespace map, given either as hash reference or as version string of
module RDF::NS. Set to the most recent version of RDF::NS by default, but
relying on a default value is not recommended!
callback¶
A code reference that is called for each triple with a list of three to five
elements:
- subject
- The subject IRI or subject blank node as string. Blank nodes always start
with "_:".
- predicate
- The predicate IRI.
- object
- The object IRI or object blank node or literal object as string. Blank
nodes always start with "_:" and literal objects can be detected
by existence of the (possibly empty) language or datatype element.
- language
- The language tag (possible the empty string) for literal objects.
- datatype
- The object's datatype if object is a literal and datatype is not
"http://www.w3.org/2001/XMLSchema#string".
For convenience an instance of RDF::Trine::Model can also be used as callback.
complain¶
What to do on errors. Set to 1 be default (warn). Set to 0 to ignore. Other
values will die on errors.
strict¶
Enables errors on undefined subjects, predicates, and objects. By default the
Perl value "undef" in any part of an encoded RDF triple will
silently ignore the triple, so aREF structures can easily be used as templates
with optional values.
null¶
A null object that is treated equivalent to "undef" if found as
object. For instance setting this to the empty string will ignore all triples
with the empty string as literal value.
bnode_prefix¶
A prefix for blank node identifiers. Defaults to "b", so blank node
identifiers will be "b1", "b2", "b3" etc.
bnode_counter¶
An integer to start creating blank node identifiers with. The default value
"0" results in blank node identifiers starting from "b1".
This option can be useful to avoid collision of blank node identifiers when
merging multiple aREF instances. The current counter value is accessible as
accessor.
EXPORTABLE CONSTANTS¶
On request this module exports the following regular expressions, as defined in
the aREF specification <
http://gbv.github.io/aREF/aREF.html>:
- qName
- blankNode
- IRIlike
- languageString
- languageTag
- datatypeString
SEE ALSO¶
RDF::aREF::Encoder