| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Attean::RDF - Utility package for exporting shorthand functions for constructing RDF objects | ||
| 4 | |||
| 5 | =head1 VERSION | ||
| 6 | |||
| 7 | This document describes Attean::RDF version 0.040 | ||
| 8 | |||
| 9 | =head1 SYNOPSIS | ||
| 10 | |||
| 11 | use v5.14; | ||
| 12 | use Attean::RDF; | ||
| 13 | |||
| 14 | my $s = blank('b'); | ||
| 15 | my $p = iri('http://xmlns.com/foaf/0.1/name'); | ||
| 16 | my $o = langliteral("Eve", "en"); | ||
| 17 | my $triple = triple($s, $p, $o); | ||
| 18 | say $triple->as_string; # _:b <http://xmlns.com/foaf/0.1/name> "Eve"@en . | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This is a utility package for exporting shorthand functions for constructing | ||
| 23 | RDF objects such as IRIs, Literals, Blanks, Triples, etc. | ||
| 24 | |||
| 25 | =head1 FUNCTIONS | ||
| 26 | |||
| 27 | All of the functions defined in this package may be exported (and are exported | ||
| 28 | by default). | ||
| 29 | |||
| 30 | =over 4 | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | 50 | package Attean::RDF 0.040 { | |
| 35 | 50 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 50 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 50 | require Exporter::Tiny; | |
| 39 | 50 | our @ISA = qw(Exporter::Tiny); | |
| 40 | 50 | our @EXPORT = qw(iri blank literal dtliteral langliteral variable triple quad triplepattern quadpattern bgp); | |
| 41 | |||
| 42 | 50 | require Attean; | |
| 43 | 50 | ▶ | use List::Util qw(mesh); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | 50 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | |||
| 46 | =item C<< variable( $value ) >> | ||
| 47 | |||
| 48 | C<< Attean::Variable->new($value) >> | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | 564 | ▶ | sub variable { |
|
Subroutine
variable: called CC=1 SCAR=0.0
Pod
documented
| |||
| 53 | 564 | return Attean::Variable->new(@_); | |
| 54 | } | ||
| 55 | |||
| 56 | =item C<< iri( $value ) >> | ||
| 57 | |||
| 58 | C<< Attean::IRI->new($value) >> | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | 848 | ▶ | sub iri { |
|
Subroutine
iri: called CC=1 SCAR=0.0
Pod
documented
| |||
| 63 | 848 | return Attean::IRI->new(@_); | |
| 64 | } | ||
| 65 | |||
| 66 | =item C<< blank( $value ) >> | ||
| 67 | |||
| 68 | C<< Attean::Blank->new($value) >> | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 83 | ▶ | sub blank { |
|
Subroutine
blank: called CC=1 SCAR=0.0
Pod
documented
| |||
| 73 | 83 | return Attean::Blank->new(@_); | |
| 74 | } | ||
| 75 | |||
| 76 | =item C<< literal( $value ) >> | ||
| 77 | |||
| 78 | C<< Attean::Literal->new($value) >> | ||
| 79 | |||
| 80 | =cut | ||
| 81 | |||
| 82 | 212 | ▶ | sub literal { |
|
Subroutine
literal: called CC=1 SCAR=0.0
Pod
documented
| |||
| 83 | 212 | return Attean::Literal->new(@_); | |
| 84 | } | ||
| 85 | |||
| 86 | =item C<< dtliteral( $value, $dt ) >> | ||
| 87 | |||
| 88 | C<< Attean::Literal->new( value => $value, datatype => $dt ) >> | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | 29 | ▶ | sub dtliteral { |
|
Subroutine
dtliteral: called CC=1 SCAR=0.0
Pod
documented
| |||
| 93 | 29 | my @k = qw(value datatype); | |
| 94 | 29 | return Attean::Literal->new(mesh \@k, \@_); | |
| 95 | } | ||
| 96 | |||
| 97 | =item C<< langliteral( $value, $lang ) >> | ||
| 98 | |||
| 99 | C<< Attean::Literal->new( value => $value, language => $lang ) >> | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | 2 | ▶ | sub langliteral { |
|
Subroutine
langliteral: called CC=1 SCAR=0.0
Pod
documented
| |||
| 104 | 2 | my @k = qw(value language); | |
| 105 | 2 | $DB::single = 1; | |
| 106 | 2 | return Attean::Literal->new(mesh \@k, \@_); | |
| 107 | } | ||
| 108 | |||
| 109 | =item C<< triple( @terms ) >> | ||
| 110 | |||
| 111 | C<< Attean::Triple->new( @terms ) >> | ||
| 112 | |||
| 113 | =cut | ||
| 114 | |||
| 115 | 185 | ▶ | sub triple { |
|
Subroutine
triple: called CC=1 SCAR=0.0
Pod
documented
| |||
| 116 | 185 | return Attean::Triple->new(@_); | |
| 117 | } | ||
| 118 | |||
| 119 | =item C<< triplepattern( @terms ) >> | ||
| 120 | |||
| 121 | C<< Attean::TriplePattern->new( @terms ) >> | ||
| 122 | |||
| 123 | =cut | ||
| 124 | |||
| 125 | 122 | ▶ | sub triplepattern { |
|
Subroutine
triplepattern: called CC=1 SCAR=0.0
Pod
documented
| |||
| 126 | 122 | return Attean::TriplePattern->new(@_); | |
| 127 | } | ||
| 128 | |||
| 129 | =item C<< quad( @terms ) >> | ||
| 130 | |||
| 131 | C<< Attean::Quad->new( @terms ) >> | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | 43 | ▶ | sub quad { |
|
Subroutine
quad: called CC=1 SCAR=0.0
Pod
documented
| |||
| 136 | 43 | return Attean::Quad->new(@_); | |
| 137 | } | ||
| 138 | |||
| 139 | =item C<< quadpattern( @terms ) >> | ||
| 140 | |||
| 141 | C<< Attean::QuadPattern->new( @terms ) >> | ||
| 142 | |||
| 143 | =cut | ||
| 144 | |||
| 145 | 8 | ▶ | sub quadpattern { |
|
Subroutine
quadpattern: called CC=1 SCAR=0.0
Pod
documented
| |||
| 146 | 8 | return Attean::QuadPattern->new(@_); | |
| 147 | } | ||
| 148 | |||
| 149 | =item C<< bgp( @triplepatterns ) >> | ||
| 150 | |||
| 151 | C<< Attean::Algebra::BGP->new( triples => \@triplepatterns ) >> | ||
| 152 | |||
| 153 | =cut | ||
| 154 | |||
| 155 | 8 | ▶ | sub bgp { |
|
Subroutine
bgp: called CC=1 SCAR=0.0
Pod
documented
| |||
| 156 | 8 | return Attean::Algebra::BGP->new(triples => \@_); | |
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | 50 | 1; | |
| 161 | |||
| 162 | __END__ | ||