PHPackages                             sweetrdf/in-memory-store-sqlite - 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/in-memory-store-sqlite

ActiveLibrary

sweetrdf/in-memory-store-sqlite
===============================

RDF in-memory quad store implementation using PDO and SQLite.

2.0.0(1y ago)35001GPL-2.0PHPPHP &gt;=8.0

Since Mar 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sweetrdf/in-memory-store-sqlite)[ Packagist](https://packagist.org/packages/sweetrdf/in-memory-store-sqlite)[ Docs](https://github.com/sweetrdf/in-memory-store-sqlite)[ RSS](/packages/sweetrdf-in-memory-store-sqlite/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

RDF In-Memory Quad Store
========================

[](#rdf-in-memory-quad-store)

[![CI](https://github.com/sweetrdf/in-memory-store-sqlite/workflows/Tests/badge.svg)](https://github.com/sweetrdf/in-memory-store-sqlite/workflows/Tests/badge.svg)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a5973b8169b5af3a7293099f21f87e736868f17b4dff894660c14b302c801e30/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73776565747264662f696e2d6d656d6f72792d73746f72652d73716c6974652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sweetrdf/in-memory-store-sqlite/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/209c3c0228d97ba35de974574e9c644db1dfac4360c5ff3492a85d448142198a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73776565747264662f696e2d6d656d6f72792d73746f72652d73716c6974652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sweetrdf/in-memory-store-sqlite/?branch=master)

Proof-of-concept RDF in-memory quad store implementation using PDO and SQLite.

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

[](#installation)

To install this library use Composer via:

> composer require sweetrdf/in-memory-store-sqlite

Usage
-----

[](#usage)

Use `InMemoryStoreSqlite::createInstance()` to get a ready-to-use store instance (see example below). Sending SPARQL queries can be done via `query` method. Your data is stored inside an in-memory SQLite database file. **After the script ends all your data inside the store will be gone**.

Examples
--------

[](#examples)

### Example 1 (First steps)

[](#example-1-first-steps)

Create a store instance, load a few triples into it and run a query.

```
use sweetrdf\InMemoryStoreSqlite\Store\InMemoryStoreSqlite;

// get ready to use store instance
$store = InMemoryStoreSqlite::createInstance();

// send a SPARQL query which creates two triples
$store->query('INSERT INTO  {
      "baz" .
      "label1" .
}');

// send another SPARQL query asking for all triples
$res = $store->query('SELECT * WHERE {?s ?p ?o.}');
$triples = $res['result']['rows'];
echo \count($triples); // outputs: 2
// $triples contains result set, which consists of arrays and scalar values
```

SPARQL support
--------------

[](#sparql-support)

Store supports a lot of SPARQL 1.0/1.1 features. For more information please read [SPARQL-support.md](doc/SPARQL-support.md).

Performance
-----------

[](#performance)

Store uses an in-memory SQLite file configured with:

- `PRAGMA synchronous = OFF`
- `PRAGMA journal_mode = OFF`
- `PRAGMA locking_mode = EXCLUSIVE`
- `PRAGMA page_size = 4096`

Check [PDOSQLiteAdapter.php](src/PDOSQLiteAdapter.php#L45) for more information.

When adding several hundred or more triples at once you may experience increased execution time. Local tests showed that per second around 1500 triples can be added.

License
-------

[](#license)

This work is licensed under the terms of the GPL 2.

Acknowledgement
---------------

[](#acknowledgement)

This work is based on the code of ARC2 from  (by Benjamin Nowak and contributors). To see what was extracted check pull request [\#1](https://github.com/sweetrdf/in-memory-store-sqlite/pull/1). ARC2 is dual licensed under the terms of GPL 2 (or later) as well as W3C Software License.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~269 days

Recently: every ~333 days

Total

6

Last Release

538d ago

Major Versions

1.1.1 → 2.0.02024-11-26

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

RDFsparqlin-memory store

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/sweetrdf-in-memory-store-sqlite/health.svg)

```
[![Health](https://phpackages.com/badges/sweetrdf-in-memory-store-sqlite/health.svg)](https://phpackages.com/packages/sweetrdf-in-memory-store-sqlite)
```

###  Alternatives

[easyrdf/easyrdf

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

62231.5M42](/packages/easyrdf-easyrdf)[semsol/arc2

ARC2 is a PHP library for working with RDF. It also provides a MySQL-based triplestore with SPARQL support.

334250.0k15](/packages/semsol-arc2)[api-platform/schema-generator

Various tools to generate a data model based on Schema.org vocables

4714.2M7](/packages/api-platform-schema-generator)[sweetrdf/easyrdf

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

261.3M11](/packages/sweetrdf-easyrdf)[digitalbazaar/json-ld

A JSON-LD Processor and API implementation in PHP.

28555.4k1](/packages/digitalbazaar-json-ld)[bordercloud/sparql

Lib PHP very easy for SPARQL 1.1

27100.4k](/packages/bordercloud-sparql)

PHPackages © 2026

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