ARC2 is a PHP 5.6+ library for working with RDF (It may be compatible with PHP 5.3+ but outdated versions are no longer tested). It also provides a MySQL-based triplestore with SPARQL support.
ARC2 is a PHP 7.2 library for working with RDF. It also provides a MySQL-based triplestore with SPARQL support. Older versions of PHP may work, but are not longer tested.
Package available on Composer.
If you're using Composer to manage dependencies, you can use
composer require semsol/arc2:^2
Further information about composer usage can be found here, for instance about autoloading ARC2 classes.
(1) It is compatible with PHP 5.3+ but old versions are no longer tested.
(2) Not tested anymore, because outdated version.
Please have a look into SPARQL-support.md to see which SPARQL 1.0/1.1 features are currently supported.
The RDF store implementation provides a hash-based query cache. It works on two levels: SQL and SPARQL, which means, that it checks given SPARQL queries as well as internally generated SQL queries.
To use it, just add the following to the database configuration:
$store = ARC2::getStore(array( 'db_name' => 'testdb', 'db_user' => 'root', 'db_pwd' => '', 'db_host' => '127.0.0.1', // ... 'cache_enabled' => true // <== activates cache ));
Per default it uses a file based cache, which stores items in the default temp folder of the system (in Linux its usually
/tmp). But you can use another cache solution, such as memcached.
Our cache solution is PSR-16 compatible, which means, that you can use your own cache instance. To do that, add the following to the database configuration:
$store = ARC2::getStore(array( 'db_name' => 'testdb', 'db_user' => 'root', 'db_pwd' => '', 'db_host' => '127.0.0.1', // ... 'cache_enabled' => true 'cache_instance' => new ArrayCache() // <=== example Cache instance, managed by yourself ));
In this section you find known problems with MariaDB or MySQL, regarding certain features. E.g. MySQL 5.5 doesn't allow FULLTEXT indexes in InnoDB. We try to encapsulate any differences in the DB adapters, so that you don't have to care about them. In case you run into problems, this section might be of help.
Using mysqli with MySQL 8.0 as backend throws the following exception:
mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
Based on this source, one has to change the my.cnf, adding the following entry:
Please have a look here to find information about maintaining and extending ARC2 as well as our docker setup for local development.