https://github.com/claudiuceia/redis-hexastore
A lightweight hexastore implementation, uzing Redis sorted sets. Work in progress.
https://github.com/claudiuceia/redis-hexastore
deno redis typescript
Last synced: about 2 months ago
JSON representation
A lightweight hexastore implementation, uzing Redis sorted sets. Work in progress.
- Host: GitHub
- URL: https://github.com/claudiuceia/redis-hexastore
- Owner: ClaudiuCeia
- License: mit
- Created: 2022-07-11T15:01:35.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-09T10:24:49.000Z (over 3 years ago)
- Last Synced: 2025-02-18T21:40:00.441Z (over 1 year ago)
- Topics: deno, redis, typescript
- Language: TypeScript
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redis-hexastore
A lightweight
[hexastore](http://redis.io/topics/indexes#representing-and-querying-graphs-using-an-hexastore)
implementation, uzing
[Redis](https://redis.io/docs/manual/data-types/#sorted-sets) sorted sets. It
allows storing graphs as triples (`subject`, `predicate`, `object`) and
querying them in an efficient manner.
## Example
```ts
const hexastore = await Hexastore.get(
{
hostname: "127.0.0.1",
port: 6379,
},
{
name: "example",
},
);
await hexastore.batchSave([
{
subject: "Adrian",
predicate: "lives",
object: "Romania",
},
{
subject: "Ana",
predicate: "lives",
object: "Germany",
},
{
subject: "Erika",
predicate: "lives",
object: "Germany",
},
{
subject: "Adrian",
predicate: "likes",
object: "beer",
},
{
subject: "Ana",
predicate: "likes",
object: "beer",
},
]);
const germans = await hexastore.query({
predicate: "lives",
object: "Germany",
});
/**
[{
subject: "Ana",
predicate: "lives",
object: "Germany",
},
{
subject: "Erika",
predicate: "lives",
object: "Germany",
}]
*/
const beerLikers = await hexastore.query({
predicate: "likes",
object: "beer",
});
/**
[
{
object: "beer",
predicate: "likes",
subject: "Adrian",
},
{
object: "beer",
predicate: "likes",
subject: "Ana",
},
]
*/
hexastore.close();
```
# License
MIT © [Claudiu Ceia](https://github.com/ClaudiuCeia)