Skip to main content

File System with semantics

Project description

# stfile

Python wrapper for RDFLib applied to a file system ontology.

## Getting started
stfile lets you use semantics to tag folders and files.

Tag your files:
```
stf tag path tags [tags ...]
```

List files by given tags:
```
stf list tags [tags ...]
```


### Installing
Use pip to install stfile
```
pip install stfile
```

You can now run the `stf` command or import stfile itself to develop your own stuff.

### Enhance Your Files

Use stfile to develop your own services. Add a Python script on the config file "config.yml" and attach tags.
```
services:
my-service:
- <my>:<super_useful_tag>
```
Every time stfile finds a tag attached to a service executes the script with the same name inside the `services/` folder.

A service must implement a `action(graph, namespaces, node_path_dictionary)` function.
* __graph__: A RDFLib Graph instance, contains all current information about the semantic file system
* __namespaces__: A dictionary containing all registered namespaces inside graph
* __node_path_dictionary__: Contains information about the nodes in a `node: path` fashion.

All namespaces included in config.yml will be loaded into the graph to offer basic covering for the file system ontology, but more can be added in order to develop services.

## Semantics

If you wish to have a better perspective about the graph
```
stf show [-h] [-f {n3,xml,pretty-xml,nt}]

Shows whole graph

optional arguments:
-h, --help show this help message and exit
-f {n3,xml,pretty-xml,nt}, --format {n3,xml,pretty-xml,nt}
Format of serialization of graph
```

### SPARQL
stfile lets you write SPARQL queries directly to your graph
```
stf query [-h] ([-s SELECT [SELECT ...] | -c CONSTRUCT [CONSTRUCT ...]
| -d DESCRIBE [DESCRIBE ...] | -a ASK [ASK ...]]
[-r RAW [RAW ...] | -i INPUT] [-w WHERE [WHERE ...]]
[-o OUTPUT]

Execute raw SPARQL query

optional arguments:
-h, --help show this help message and exit
-s SELECT [SELECT ...], --select SELECT [SELECT ...]
Select query
-c CONSTRUCT [CONSTRUCT ...], --construct CONSTRUCT [CONSTRUCT ...]
Construct query
-d DESCRIBE [DESCRIBE ...], --describe DESCRIBE [DESCRIBE ...]
Describe query
-a ASK [ASK ...], --ask ASK [ASK ...]
Ask query
-r RAW [RAW ...], --raw RAW [RAW ...]
Raw SPARQL query
-i INPUT, --input INPUT
input file
-w WHERE [WHERE ...], --where WHERE [WHERE ...]
Where statement
-o OUTPUT, --output OUTPUT
output file
```


Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stfile-0.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

stfile-0.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file stfile-0.1.tar.gz.

File metadata

  • Download URL: stfile-0.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for stfile-0.1.tar.gz
Algorithm Hash digest
SHA256 1ff567038cb674b448b12e4b3282a7a9221a917e83f26f4c833b7898b5c16053
MD5 ec7c0a06e4d40ab9208362534de9742f
BLAKE2b-256 710178115dffe226e189ec1e92027b12c4b17f2714ef54433508984c01ba71c1

See more details on using hashes here.

File details

Details for the file stfile-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for stfile-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5ee0a756738463c8e09d5d313c0292e8e5c6e395dc33035dfb530620fe3d6e6
MD5 7fcb613ca0788c1304f8c90625c6cf49
BLAKE2b-256 dd91e3afa7921b39c20866fdbaed73bb4dff6a6268a39ee16e3996550978e42a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page