The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JSONLD - A toolkit for interacting with JSON-LD data.

VERSION

This document describes JSONLD version 0.000_03

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);

DESCRIPTION

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

METHODS

expand( $data, [expandContext => $ctx] )

Returns the JSON-LD expansion of $data.

to_rdf( $data )

Returns the dataset generated by turning the JSON-LD expansion of $data into RDF.

Note: this method must be called on a JSONLD subclass which implements the RDF-related methods:

  • default_graph()

  • new_dataset()

  • new_triple($s, $p, $o)

  • new_quad($s, $p, $o, $g)

  • new_iri($value)

  • new_graphname($value)

  • new_blank( [$id] )

  • new_lang_literal($value, $lang)

  • new_dt_literal($value, $datatype)

  • add_quad($quad, $dataset)

BUGS

Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/perl-jsonld/issues.

SEE ALSO

AtteanX::Parser::JSONLD
https://www.w3.org/TR/json-ld11/
https://www.w3.org/TR/json-ld-api/

AUTHOR

Gregory Todd Williams <gwilliams@cpan.org>

COPYRIGHT

Copyright (c) 2019--2020 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.