.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RDF::aREF::Encoder 3pm" .TH RDF::aREF::Encoder 3pm "2014-10-16" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RDF::aREF::Encoder \- encode RDF to another RDF Encoding Form .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use RDF::aREF::Encoder; \& my $encoder = RDF::aREF::Encoder\->new; \& \& # encode parts of aREF \& \& my $qname = $encoder\->qname(\*(Aqhttp://schema.org/Review\*(Aq); # \*(Aqschema_Review\*(Aq \& \& my $predicate = $encoder\->predicate( \& \*(Aqhttp://www.w3.org/1999/02/22\-rdf\-syntax\-ns#type\*(Aq \& ); # \*(Aqa\*(Aq \& \& my $object = $encoder\->object({ \& type => \*(Aqliteral\*(Aq, \& value => \*(Aqhello, world!\*(Aq, \& lang => \*(Aqen\*(Aq \& }); # \*(Aqhello, world!@en\*(Aq \& \& # method also accepts RDF::Trine::Node instances \& my $object = $encoder\->object( RDF::Trine::Resource\->new($iri) ); \& \& # encode RDF graphs (see also function \*(Aqencode_aref\*(Aq in RDF::aREF) \& use RDF::Trine::Parser; \& my $aref = { }; \& RDF::Trine::Parser\->parse_file ( $base_uri, $fh, sub { \& $encoder\->add_triple( $aref, $_[0] ); \& } ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides methods to encode \s-1RDF\s0 data in another \s-1RDF\s0 Encoding Form (aREF). As aREF was designed to facilitate creation of \s-1RDF\s0 data, it may be easier to create aREF \*(L"by hand\*(R" instead of using this module! .SH "OPTIONS" .IX Header "OPTIONS" .SS "ns" .IX Subsection "ns" A default namespace map, given as version string of module \s-1RDF::NS\s0 for stable qNames or as instance of \s-1RDF::NS\s0. The most recent installed version of \s-1RDF::NS\s0 is used by default. The value \f(CW0\fR can be used to only use required namespace mappings (rdf, rdfs, owl and xsd). .SH "METHODS" .IX Header "METHODS" Note that no syntax checking is applied, e.g. whether a given \s-1URI\s0 is a valid \&\s-1URI\s0 or whether a given language is a valid language tag! .ie n .SS "qname( $uri )" .el .SS "qname( \f(CW$uri\fP )" .IX Subsection "qname( $uri )" Abbreviate an \s-1URI\s0 as qName or return \f(CW\*(C`undef\*(C'\fR. For instance \&\f(CW\*(C`http://purl.org/dc/terms/title\*(C'\fR is abbreviated to "\f(CW\*(C`dct_title\*(C'\fR". .ie n .SS "uri( $uri )" .el .SS "uri( \f(CW$uri\fP )" .IX Subsection "uri( $uri )" Abbreviate an \s-1URI\s0 or as qName or enclose it in angular brackets. .ie n .SS "predicate( $uri )" .el .SS "predicate( \f(CW$uri\fP )" .IX Subsection "predicate( $uri )" Return an predicate \s-1URI\s0 as qNamem, as "\f(CW\*(C`a\*(C'\fR", or as given \s-1URI.\s0 .ie n .SS "literal( $value, $language_tag, $datatype_uri )" .el .SS "literal( \f(CW$value\fP, \f(CW$language_tag\fP, \f(CW$datatype_uri\fP )" .IX Subsection "literal( $value, $language_tag, $datatype_uri )" Encode a literal \s-1RDF\s0 node by either appending "\f(CW\*(C`@\*(C'\fR\*(L" and an optional language tag, or \*(R"\f(CW\*(C`^\*(C'\fR" and an datatype \s-1URI.\s0 .ie n .SS "bnode( $identifier )" .el .SS "bnode( \f(CW$identifier\fP )" .IX Subsection "bnode( $identifier )" Encode a blank node by prepending "\f(CW\*(C`_:\*(C'\fR" to its identifier. .ie n .SS "object( $object )" .el .SS "object( \f(CW$object\fP )" .IX Subsection "object( $object )" Encode an \s-1RDF\s0 object given either as hash reference as defined in \&\s-1RDF/JSON\s0 format (see also method \&\f(CW\*(C`as_hashref\*(C'\fR of RDF::Trine::Model), or in array reference as internally used by RDF::Trine. .PP A hash reference is expected to have the following fields: .IP "type" 4 .IX Item "type" one of \f(CW\*(C`uri\*(C'\fR, \f(CW\*(C`literal\*(C'\fR or \f(CW\*(C`bnode\*(C'\fR (required) .IP "value" 4 .IX Item "value" the \s-1URI\s0 of the object, its lexical value or a blank node label depending on whether the object is a uri, literal or bnode .IP "lang" 4 .IX Item "lang" the language of a literal value (optional but if supplied it must not be empty) .IP "datatype" 4 .IX Item "datatype" the datatype \s-1URI\s0 of the literal value (optional) .PP An array reference is expected to consists of .IP "\(bu" 4 three elements (value, language tag, and datatype uri) for literal nodes, .IP "\(bu" 4 two elements "\f(CW\*(C`URI\*(C'\fR" and the \s-1URI\s0 for \s-1URI\s0 nodes, .IP "\(bu" 4 two elements "\f(CW\*(C`BLANK\*(C'\fR" and the blank node identifier for blank nodes. .ie n .SS "add_triple( $aref, $statement )" .el .SS "add_triple( \f(CW$aref\fP, \f(CW$statement\fP )" .IX Subsection "add_triple( $aref, $statement )" Add a RDF::Trine::Stament to an aREF subject map. .PP \&\fIexperimental\fR .ie n .SS "add_iterator( $aref, $iterator )" .el .SS "add_iterator( \f(CW$aref\fP, \f(CW$iterator\fP )" .IX Subsection "add_iterator( $aref, $iterator )" Add a RDF::Trine::Iterator to an aREF subject map. .PP \&\fIexperimental\fR .ie n .SS "add_objects( $predicate_map, $predicate, $objects )" .el .SS "add_objects( \f(CW$predicate_map\fP, \f(CW$predicate\fP, \f(CW$objects\fP )" .IX Subsection "add_objects( $predicate_map, $predicate, $objects )" \&\fIexperimental\fR .ie n .SS "add_hashref( $aref, $rdf )" .el .SS "add_hashref( \f(CW$aref\fP, \f(CW$rdf\fP )" .IX Subsection "add_hashref( $aref, $rdf )" Add \s-1RDF\s0 given in \s-1RDF/JSON\s0 format (as returned by method \f(CW\*(C`as_hashref\*(C'\fR in RDF::Trine::Model). .PP \&\fIexperimental\fR .SH "SEE ALSO" .IX Header "SEE ALSO" RDF::aREF::Decoder, RDF::Trine::Node