https://github.com/capsulecorplab/patternbuffer
a Pharo/Smalltalk package for working with linked data models
https://github.com/capsulecorplab/patternbuffer
pharo rdf rdflib smalltalk sparql
Last synced: 3 months ago
JSON representation
a Pharo/Smalltalk package for working with linked data models
- Host: GitHub
- URL: https://github.com/capsulecorplab/patternbuffer
- Owner: capsulecorplab
- License: mit
- Created: 2021-07-17T03:43:41.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T22:47:59.000Z (over 2 years ago)
- Last Synced: 2023-03-11T13:27:14.076Z (about 2 years ago)
- Topics: pharo, rdf, rdflib, smalltalk, sparql
- Language: Smalltalk
- Homepage:
- Size: 104 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PatternBuffer
PatternBuffer is a Pharo/Smalltalk client for querying RDF databases.
## Requirements
### For Linux (Ubuntu 20.04 Recommended)
- [Pharo](https://pharo.org/download) (10.0 recommended)
- [RDFLib](https://github.com/RDFLib/rdflib) installed on system Python## Loading instructions
To load the latest release, open a playground window (`Ctrl+O+W`) and evaluate:
```smalltalk
Metacello new baseline: 'PatternBuffer';
repository: 'github://capsulecorplab/patternbuffer:v0.4.1';
load.
```NOTE: Evaluate by highlighting the code, then either right-click on the highlighted code and click `Do it` or press `Ctrl+D`.
## Example Usage
Once the `PatternBuffer` package has been loaded into your Pharo image, you can run a SPARQL query against an RDF datastore.
For example, evaluate and inspect the following in a playground window (`Ctrl+O+W`) to execute a query for assemblies & subassemblies against a TTL file downloaded from the [firesat](https://github.com/opencaesar/firesat-example) database:
```smalltalk
firesatClient := PBSPARQL new
datastore: '/home/kasm-user/firesat-example/firesat.ttl';
query: 'PREFIX fse:
PREFIX base:SELECT ?assembly ?subassembly
WHERE {
?assembly base:contains ?subassembly
}'.
```Results of the SPARQL query can be viewed as a JSON object,
```smalltalk
firesatClient resultAsJSON.
```or as a table,
```smalltalk
firesatClient resultAsTable.
```NOTE: Evaluate and inspect the result by highlighting the code, then either right-click on the highlighted code and click `Do it and go` or press `Ctrl+G`.