JSONLD

 view release on metacpan or  search on metacpan

lib/JSONLD.pm  view on Meta::CPAN

=head1 NAME

JSONLD - A toolkit for transforming JSON-LD data.

=head1 VERSION

This document describes JSONLD version 0.006.

=head1 SYNOPSIS

  use v5.14;
  use JSON;
  use JSONLD;
  
  my $infile = 'test.jsonld';
  open(my $fh, '<', $infile) or die $!;
  my $content	= do { local($/); <$fh> };
  my $data = JSON->new()->boolean_values(0, 1)->decode($content);
  
  my $jld = JSONLD->new();
  my $expanded	= $jld->expand($data);

=head1 DESCRIPTION

This module implements part of the JSON-LD 1.1 standard for manipulating JSON
data as linked data.

This version provides full support for the JSON-LD 1.1 "Expansion" and
"toRdf" transformations (the latter primarily being useful through a subclass
of JSON-LD, such as that provided by L<AtteanX::Parser::JSONLD>).
Partial support for the "Compaction" transformation is provided, but it
contains many known deficiencies. Full support for "Compaction" may be
forthcoming in a future release.
No other JSON-LD transformation are supported at this time.

=head1 METHODS

=over 4

=cut

package JSONLD {
	use v5.14;
	use autodie;
	our $VERSION	= '0.006';
	use utf8;
	use Moo;
	use LWP;
	use List::Util qw(all any);
	use JSON;
	use JSON qw(decode_json);
	use IRI;
	use FindBin qw($Bin);
	use File::Spec;
	use File::Glob qw(bsd_glob);
	use Encode qw(encode decode_utf8);
	use Data::Dumper;
	use Clone 'clone';
	use Carp qw(confess);
	use B qw(svref_2object SVf_IOK SVf_POK SVf_NOK SVf_IOK);
	use namespace::clean;
# 	use Debug::ShowStuff qw(indent println);
	sub println ($) {}
	sub indent {}
	
	has 'base_iri' => (is => 'rw', required => 0, default => sub { IRI->new('http://example.org/') });
	has 'processing_mode' => (is => 'ro', default => 'json-ld-1.1');
	has 'max_remote_contexts' => (is => 'rw', default => 10);
	has 'parsed_remote_contexts' => (is => 'rw', default => sub { +{} });
	has 'rdf_direction' => (is => 'rw');
	has 'identifier_map' => (is => 'rw', default => sub { +{} });
	has 'next_identifier_id' => (is => 'rw', default => 0);
	has 'default_language' => (is => 'rw');
	has 'default_base_direction' => (is => 'rw');
	
	our $debug		= 0;
	my %keywords	= map { $_ => 1 } qw(: @base @container @context @direction @graph @id @import @included @index @json @language @list @nest @none @prefix @propagate @protected @reverse @set @type @value @version @vocab);
	



( run in 1.579 second using v1.01-cache-2.11-cpan-140bd7fdf52 )