Skip to content

Commit

Permalink
update code, build infrastructe and fix compatibility with new rdflib
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Oct 24, 2023
1 parent d9b86da commit b185835
Show file tree
Hide file tree
Showing 22 changed files with 2,220 additions and 539 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
branch = True
omit =
tests/*
[report]
exclude_lines =
pragma: no cover
raise NotImplementedError
return NotImplemented
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: rdflib-django3

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install poetry
run: python -m pip install poetry
- name: Install package
run: poetry install --only main,test
- name: Run tox
run: poetry run tox -s
- name: Convert coverage
run: poetry run coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.*project
*.py[co]
.vscode
.venv

# Packages
*.egg
Expand Down
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.publysher
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018, Alexander K.
Copyright (c) 2012, Publysher

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# rdflib-django3

fork from rdflib-django with multi store architecture, python3 and recent rdflib
compatibility.

A store implementation for `rdflib` that uses Django as its backend.

The current implementation is context-aware but not formula-aware.

The implementation assumes that contexts are used for named graphs.

# Quick start

Install rdflib-django3 with your package manager:

```sh
pip install rdflib-django3
```

Add `rdflib_django` to your `INSTALLED_APPS`:

```python

INSTALLED_APPS = (
# other apps
'rdflib_django'.
)
```

You can now use the following examples to obtain a graph.

Getting a graph using rdflib's store API:

```python

from rdflib import Graph

graph = Graph('Django', identifier="fooo")
graph.open(create=True)
```

This example will give you a graph identified by a blank node within the
default store.

Getting a conjunctive graph using rdflib's store API:

```python

from rdflib import ConjunctiveGraph
graph = ConjunctiveGraph('Django')
```

This example will give you a conjunctive graph in the default store.

Getting a named graph using rdflib-django's API:

```python

from rdflib_django import utils
graph = utils.get_named_graph('http://example.com')
```

Getting the conjunctive graph using rdflib-django3's API:

```python

from rdflib_django import utils
graph = utils.get_conjunctive_graph()
```

## Management commands

`rdflib-django3` includes two management commands to import and export
RDF:

```sh

python manage.py import_rdf --context=http://example.com my_file.rdf
python manage.py export_rdf --context=http://example.com
```

## License

`rdflib-django3` is licensed under the `MIT license`.

## Links

[rdflib](http://pypi.python.org/pypi/rdflib/)
92 changes: 0 additions & 92 deletions README.rst

This file was deleted.

Empty file added codecov.yml
Empty file.
4 changes: 1 addition & 3 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
if __name__ == "__main__":
if BASE_DIR not in sys.path:
sys.path.insert(0, BASE_DIR)
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "test.testsettings"
)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.testsettings")
try:
from django.core.management import execute_from_command_line
except ImportError:
Expand Down
Loading

0 comments on commit b185835

Please sign in to comment.