pdsinterop/flysystem-rdf

Flysystem plugin to transform RDF data between various serialization formats.

v0.2.0 2020-09-24 14:27 UTC

This package is auto-updated.

Last update: 2020-10-15 16:56:58 UTC


README

PDS Interop Project stage: Development License Latest Version standard-readme compliant Maintained

Flysystem plugin to transform RDF data between various serialization formats.

When using RDF, you will seen notice there are several different popular serialization formats. Instead of having to store data in multiple formats, it is easier to store the data in one format and convert it to others as needed.

This project contains a plugin to be used with Flysystem to do just that.

For the conversion EasyRDF is used. Any formats supported by EasyRDF are available from this plugin.

Currently supported formats are:

  • JSON-LD
  • N-triples
  • Notation 3 / N3
  • RDF/XML
  • Turtle

Table of Contents

Background

This project is part of the PHP stack of projects by PDS Interop. It is used by both the Solid-Nextcloud app and the standalone PHP Solid server.

As the functionality seemed useful for other projects, it was implemented as a separate package.

Installation

The advised install method is through composer:

composer require pdsinterop/flysystem-rdf

PHP version 7.1 and higher is supported. The mbstring extension needs to be enabled in order for this package to work.

Usage

To use this package, instantiate the plugin and add it to a Flysystem filesystem.

The function readRdf can then be called to get RDF files in a specific format:

<?php declare(strict_types=1);

$adapter = new League\Flysystem\Adapter\Local('/path/to/files/');
$filesystem = new League\Flysystem\Filesystem($adapter);
$graph = new \EasyRdf_Graph();
$plugin = new \Pdsinterop\Rdf\Flysystem\Plugin\ReadRdf($graph);

$filesystem->addPlugin($plugin);

$content = $filesystem->readRdf('/foaf.rdf', \Pdsinterop\Rdf\Enum\Format::TURTLE);

Contribute

Questions or feedback can be given by opening an issue on GitHub.

All PDS Interop projects are open source and community-friendly. Any contribution is welcome! For more details read the contribution guidelines.

All PDS Interop projects adhere to the Code Manifesto as its code-of-conduct. Contributors are expected to abide by its terms.

There is a list of all contributors on GitHub.

For a list of changes see the CHANGELOG or the GitHub releases page.

License

All code created by PDS Interop is licensed under the MIT License.