sweetyrdf / easyrdf
EasyRdf is a PHP library designed to make it easy to consume and produce RDF.
Requires
- php: >=5.5
- ext-mbstring: *
- ext-pcre: *
Requires (Dev)
- ml/json-ld: ^1.1
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ~4.8.36|^6|^7
- sami/sami: >=3.3
- semsol/arc2: ^2.4
- squizlabs/php_codesniffer: ~1.4.3
- zendframework/zend-http: ^2.3
Suggests
- ml/json-ld: ^1.1
- semsol/arc2: ^2.4
This package is auto-updated.
Last update: 2020-09-18 11:31:24 UTC
README
❗ This is a forked version of EasyRdf.
Status of this fork
Because EasyRdf got revived to some extend and I can help out as a maintainer there, I decided to archive this repository for now.
Why this fork?
EasyRdf was in maintenance mode since 2017 (link) and not actively maintained since. There are 6+ pull requests pending with fixes and new features. Its sad to see another RDF PHP project die slowly, so i decided to clean house and give the code a new home (further info).
What can you expect as a user?
This fork aims to be a drop-in replacement for the easyrdf/easyrdf
package, which means, you can use it without changing your code. But you should still read the notes of the latest release, to make sure nothing unexpected happens after an update.
What can you expect as an EasyRdf developer?
This repository is set up in a way to lower the maintenance overhead in comparison to the original version. For instance, by adding coveralls service (easier test coverage overview) and reworked tooling (reduced bash code in Makefile, keep commands simple).
Furthermore, this repository is held by an organization instead of a user. This allows more flexible maintenance, like add further maintainer or helper.
Contributions are welcome! Please read CONTRIBUTING.md for further information.
Further mainainers are possible, please send an email to @k00ni.
About
EasyRdf is a PHP library designed to make it easy to consume and produce RDF. It was designed for use in mixed teams of experienced and inexperienced RDF developers. It is written in Object Oriented PHP and has been tested extensively using PHPUnit.
After parsing EasyRdf builds up a graph of PHP objects that can then be walked around to get the data to be placed on the page. Dump methods are available to inspect what data is available during development.
Data is typically loaded into an EasyRdf\Graph
object from source RDF
documents, loaded from the web via HTTP. The EasyRdf\GraphStore
class
simplifies loading and saving data to a SPARQL 1.1 Graph Store.
SPARQL queries can be made over HTTP to a Triplestore using the
EasyRdf\Sparql\Client
class. SELECT
and ASK
queries will return an
EasyRdf\Sparql\Result
object and CONSTRUCT
and DESCRIBE
queries will return
an EasyRdf\Graph
object.
Example
$foaf = new \EasyRdf\Graph("http://njh.me/foaf.rdf"); $foaf->load(); $me = $foaf->primaryTopic(); echo "My name is: ".$me->get('foaf:name')."\n";
Downloads
The latest stable version of EasyRdf can be downloaded from the EasyRdf website.
Links
- EasyRdf Homepage (outdated)
- API documentation (outdated)
- Change Log (outdated)
- Source Code
- Issue Tracker
Requirements
- PHP 7.0 or higher
Features
- API documentation written in
phpdoc
- Extensive unit tests written using
phpunit
- Built-in parsers and serialisers: RDF/JSON, N-Triples, RDF/XML, Turtle
- Optional parsing support for: ARC2, rapper
- Optional support for
Zend\Http\Client
- No required external dependancies upon other libraries (PEAR, Zend, etc...)
- Complies with Zend Framework coding style.
- Type mapper - resources of type
foaf:Person
can be mapped into PHP object of classFoaf_Person
- Support for visualisation of graphs using GraphViz
- Comes with a number of examples
More Examples
-
basic.php
- Basic "Hello World" type example -
basic_sparql.php
- Example of making a SPARQLSELECT
query -
converter.php
- Convert RDF from one format to another -
dump.php
- Display the contents of a graph -
foafinfo.php
- Display the basic information in a FOAF document -
foafmaker.php
- Construct a FOAF document with a choice of serialisations -
graph_direct.php
- Example of usingEasyRdf\Graph
directly withoutEasyRdf\Resource
-
graphstore.php
- Store and retrieve data from a SPARQL 1.1 Graph Store -
graphviz.php
- GraphViz rendering example -
html_tag_helpers.php
- Rails Style html tag helpers to make the EasyRdf examples simpler -
httpget.php
- No RDF, just testEasyRdf\Http\Client
-
serialise.php
- Basic serialisation example -
sparql_queryform.php
- Form to submit SPARQL queries and display the result -
uk_postcode.php
- Example of resolving UK postcodes using uk-postcodes.com -
zend_framework.php
- Example of usingZend\Http\Client
with EasyRdf -
artistinfo.php
- Example of mapping an RDF class type to a PHP Class -
basic.php
- Basic "Hello World" type example -
basic_sparql.php
- Example of making a SPARQLSELECT
query -
converter.php
- Convert RDF from one format to another -
dump.php
- Display the contents of a graph -
foafinfo.php
- Display the basic information in a FOAF document -
foafmaker.php
- Construct a FOAF document with a choice of serialisations -
graph_direct.php
- Example of usingEasyRdf\Graph
directly withoutEasyRdf\Resource
-
graphstore.php
- Store and retrieve data from a SPARQL 1.1 Graph Store -
graphviz.php
- GraphViz rendering example -
html_tag_helpers.php
- Rails Style html tag helpers to make the EasyRdf examples simpler -
httpget.php
- No RDF, just testEasyRdf\Http\Client
-
open_graph_protocol.php
- Extract Open Graph Protocol metadata from a webpage -
serialise.php
- Basic serialisation example -
sparql_queryform.php
- Form to submit SPARQL queries and display the result -
uk_postcode.php
- Example of resolving UK postcodes using uk-postcodes.com -
wikidata_villages.php
- Fetch and information about villages in Fife from Wikidata -
zend_framework.php
- Example of usingZend\Http\Client
with EasyRdf
Running Examples
The easiest way of trying out some of the examples is to use the PHP command to run a local web server on your computer.
php -S localhost:8080 -t examples
Then open the following URL in your browser: http://localhost:8080/
Licensing
The EasyRdf library and tests are licensed under the BSD-3-Clause license. The examples are in the public domain, for more information see UNLICENSE.