1. Go to this page and download the library: Download pdsinterop/flysystem-rdf library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pdsinterop / flysystem-rdf example snippets
// Create Formats objects
$formats = new \Pdsinterop\Rdf\Formats();
// Use an adapter of your choice
$adapter = new League\Flysystem\Adapter\Local('/path/to/files/');
// Create the RDF Adapter
$rdfAdapter = new \Pdsinterop\Rdf\Flysystem\Adapter\Rdf(
$adapter,
new \EasyRdf\Graph(),
$formats,
'server'
);
// Create Flysystem as usual, adding the RDF Adapter
$filesystem = new League\Flysystem\Filesystem($rdfAdapter);
// Add the `AsMime` plugin to convert contents based on a provided MIME type,
$filesystem->addPlugin(new \Pdsinterop\Rdf\Flysystem\Plugin\AsMime($formats));
// Read the contents of a file in the format it was stored in
$content = $filesystem->read('/foaf.rdf');
// Read the contents of a file in another format from what was stored in
$convertedContents = $filesystem
->asMime('text/turtle')
->read('/foaf.rdf');
// Get the MIME type of the format the requested mime-type would return
// This is especially useful for RDF formats that can be requested with several
// different MIME types.
$convertedMimeType = $filesystem
->asMime('text/turtle')
->getMimetype('/foaf.rdf');
// This also works for `has`
$hasConvertedContents = $filesystem
->asMime('text/turtle')
->has('/foaf.ttl');
// Without using the plugin, this will be false
$hasContents = $filesystem->has('/foaf.ttl');
// Create Flysystem as usual, adding an adapter of your choice
$adapter = new League\Flysystem\Adapter\Local('/path/to/files/');
$filesystem = new League\Flysystem\Filesystem($adapter);
// create and add the RdF Plugin
$plugin = new \Pdsinterop\Rdf\Flysystem\Plugin\ReadRdf(new \EasyRdf\Graph());
$filesystem->addPlugin($plugin);
// Read the contents of a RDF file in another format from what was stored in
$content = $filesystem->readRdf('/foaf.rdf', \Pdsinterop\Rdf\Enum\Format::TURTLE);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.