PHPackages                             sweetrdf/quick-rdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sweetrdf/quick-rdf

ActiveLibrary

sweetrdf/quick-rdf
==================

Yet another RDF library

2.0.6(7mo ago)013.5k↓36.7%[1 issues](https://github.com/sweetrdf/quickRdf/issues)7MITPHPPHP &gt;=8.0CI failing

Since Jan 16Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/sweetrdf/quickRdf)[ Packagist](https://packagist.org/packages/sweetrdf/quick-rdf)[ Docs](https://github.com/sweetrdf/quickRdf)[ RSS](/packages/sweetrdf-quick-rdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (37)Used By (7)

quickRdf
========

[](#quickrdf)

[![Latest Stable Version](https://camo.githubusercontent.com/4289ca6b6cdbfdadfaecd4973fe886ea993b0e779b7c84fb3e381438864a6b20/68747470733a2f2f706f7365722e707567782e6f72672f73776565747264662f717569636b2d7264662f762f737461626c65)](https://packagist.org/packages/sweetrdf/quick-rdf)[![Build status](https://github.com/sweetrdf/quickRdf/workflows/phpunit/badge.svg?branch=master)](https://github.com/sweetrdf/quickRdf/workflows/phpunit/badge.svg?branch=master)[![Coverage Status](https://camo.githubusercontent.com/39735a18cc1bde15b217c191facb888b7bd976742de70c949f62cc8e9c9908d9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73776565747264662f717569636b5264662f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/sweetrdf/quickRdf?branch=master)[![License](https://camo.githubusercontent.com/95d9567834d0f32ed965a7068143bd7d2576aa634fd8a51547b774bde0aeb1f8/68747470733a2f2f706f7365722e707567782e6f72672f73776565747264662f717569636b2d7264662f6c6963656e7365)](https://packagist.org/packages/sweetrdf/quick-rdf)

An RDF library for PHP providing implementation of  terms and dataset.

Implemented to be fast and memory efficient.

This is achieved by using a global terms hash table with only a single copy of equal rdfInterface terms being stored in memory at a given time. It allows to save quite some memory in dense graphs and provides a lightning fast terms comparison (equal if and only if it's the same object). It also provides a very efficient implementation of Dataset set operations using PHP's SplObjectStorage.

The Dataset implementation maintains indexes allowing quick quads search (indexing can be turned off if needed as it significantly slows down a dataset creation).

Installation
------------

[](#installation)

- Obtain the [Composer](https://getcomposer.org)
- Run `composer require sweetrdf/quick-rdf`
- Run `composer require sweetrdf/quick-rdf-io` to install parsers and serializers.

Automatically generated documentation
-------------------------------------

[](#automatically-generated-documentation)

It's very incomplete but better than nothing.
[RdfInterface](https://github.com/sweetrdf/rdfInterface/) documentation is included which explains the most important design decisions.

Usage
-----

[](#usage)

(you can also take a look at generic rdfInterface [examples](https://github.com/sweetrdf/rdfInterface/blob/master/EasyRdfReadme.md))

```
include 'vendor/autoload.php';

use quickRdf\DataFactory as DF;

$graph = new quickRdf\Dataset();
$parser = new quickRdfIo\TriGParser();
$stream = fopen('pathToTurtleFile', 'r');
$graph->add($parser->parseStream($stream));
fclose($stream);

// count edges in the graph
echo count($graph);

// go trough all edges in the graph
foreach ($graph as $i) {
  echo "$i\n";
}

// find all graph edges with a given subject
echo $graph->copy(DF::quadTemplate(DF::namedNode('http://mySubject')));

// find all graph edges with a given predicate
echo $graph->copy(DF::quadTemplate(null, DF::namedNode('http://myPredicate')));

// find all graph edges with a given object
echo $graph->copy(DF::quadTemplate(null, null, DF::literal('value', 'en')));

// replace an edge in the graph
$edge = DF::quad(DF::namedNode('http://edgeSubject'), DF::namedNode('http://edgePredicate'), DF::namedNode('http://edgeObject'));
$graph[$edge] = $edge->withObject(DF::namedNode('http://anotherObject'));

// find intersection with other graph
$graph->copy($otherGraph); // immutable
$graph->delete($otherGraph); // in-place

// compute union with other graph
$graph->union($otherGraph); // immutable
$graph->add($otherGraph); // in-place

// compute set difference with other graph
$graph->copyExcept($otherGraph); // immutable
$graph->delete($otherGraph); // in-place

$serializer = new quickRdfIo\TurtleSerializer();
$stream = fopen('pathToOutputTurtleFile', 'w');
$serializer->serializeStream($stream, $graph);
fclose($stream);
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance75

Regular maintenance activity

Popularity26

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Recently: every ~93 days

Total

32

Last Release

228d ago

Major Versions

0.9.1 → 1.0.0-RC12022-11-01

1.0.0 → 2.0.0-RC12023-07-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1f662e3acb95efd9208cdcd2c97437db366044aea705985251760efcbd23070?d=identicon)[zozlak](/maintainers/zozlak)

---

Top Contributors

[![zozlak](https://avatars.githubusercontent.com/u/6503177?v=4)](https://github.com/zozlak "zozlak (122 commits)")[![k00ni](https://avatars.githubusercontent.com/u/381727?v=4)](https://github.com/k00ni "k00ni (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sweetrdf-quick-rdf/health.svg)

```
[![Health](https://phpackages.com/badges/sweetrdf-quick-rdf/health.svg)](https://phpackages.com/packages/sweetrdf-quick-rdf)
```

###  Alternatives

[sweetrdf/easyrdf

EasyRdf is a PHP library designed to make it easy to consume and produce RDF.

261.3M11](/packages/sweetrdf-easyrdf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
