devkral / rdflib-django3 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from publysher/rdflib-django
An implementation of the RDFlib Store API that uses Django for its backend.
License: MIT License
This project forked from publysher/rdflib-django
An implementation of the RDFlib Store API that uses Django for its backend.
License: MIT License
The tests fail because python 3.7 is not available yet on travis.
Option 1: waiting till travis supports 3.7.
Option 2: allow failures with 3.7
I'm using a Python 3.4.9_1 virtualenv with Django 1.11.18 and rdflib 4.2.2 in which I installed rdflib-django3 version 0.2.3. I added 'rdflib_django'
to the INSTALLED_APPS
setting. When trying to run the migrations, I got the following output:
$ python manage.py migrate
Applying rdflib_django.0001_initial... OK
Applying rdflib_django.0002_auto_20181112_1317...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File ".env/lib/python3.4/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File ".env/lib/python3.4/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File ".env/lib/python3.4/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File ".env/lib/python3.4/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File ".env/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File ".env/lib/python3.4/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File ".env/lib/python3.4/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File ".env/lib/python3.4/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File ".env/lib/python3.4/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File ".env/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 221, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 531, in alter_field
old_db_params, new_db_params, strict)
File ".env/lib/python3.4/site-packages/django/db/backends/postgresql/schema.py", line 112, in _alter_field
new_db_params, strict,
File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 634, in _alter_field
old_default = self.effective_default(old_field)
File ".env/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 245, in effective_default
default = field.get_db_prep_save(default, self.connection)
File ".env/lib/python3.4/site-packages/django/db/models/fields/__init__.py", line 770, in get_db_prep_save
prepared=False)
File ".env/lib/python3.4/site-packages/django/db/models/fields/__init__.py", line 762, in get_db_prep_value
value = self.get_prep_value(value)
File ".env/lib/python3.4/site-packages/rdflib_django/fields.py", line 107, in get_prep_value
return serialize_uri(value)
File ".env/lib/python3.4/site-packages/rdflib_django/fields.py", line 82, in serialize_uri
value, value.__class__)
ValueError: Cannot get prepvalue for None of type <class 'NoneType'>
Workaround suggestions welcome!
Hi, #devkral,
I was working on the management commands too. You've done it before. Thank you!
However, I'm not able to use your version without a few further patches. Please, tell me if I am wrong.
Without my patches to rdf_import, I'm getting the following errors:
python manage.py rdf_import rdf_import-200529.n3 --format n3
=> manage.py rdf_import: error: unrecognized arguments: rdf_import-200529.n3
python manage.py rdf_import --format n3 rdf_import-200529.n3
=> manage.py rdf_import: error: unrecognized arguments: rdf_import-200529.n3
python manage.py rdf_import --format n3 < rdf_import-200529.n3
=> CommandError: No file or resource specified.
Without my patches to rdf_export, I'm getting the following errors:
python manage.py rdf_export rdf_export-200529.n3 --format n3
=> manage.py rdf_export: error: unrecognized arguments: rdf_export-200529.n3
python manage.py rdf_export --format n3 rdf_export-200529.n3
=> manage.py rdf_export: error: unrecognized arguments: rdf_export-200529.n3
python manage.py rdf_export --format n3
>> Traceback (most recent call last):
...
File "C:\commons321\lib\site-packages\rdflib\plugins\serializers\turtle.py", line 156, in write
self.stream.write(text.encode(self.encoding, 'replace'))
TypeError: write() argument must be str, not bytes
python manage.py rdf_export --format n3 > rdf_export-200529.n3
>> Traceback (most recent call last):
...
File "C:\commons321\lib\site-packages\rdflib\plugins\serializers\turtle.py", line 156, in write
self.stream.write(text.encode(self.encoding, 'replace'))
TypeError: write() argument must be str, not bytes
With my corrections, I can do everything, except exporting through an os pipe; but I think that's another problem.
It seems that implementing (or emulating?) positional arguments for commands is very tricky in recent Django versions. In fact, I think that resorting to dash-style options would be more simple and clear (user friendly) also for i/o filepath arguments.
In any case, my version is in the fork at https://github.com/gtoffoli/rdflib-django3 .
NOTE: I'm developing with Python 3.5 and Django 2.1, on Windows 10; will put in production on Ubuntu.
Best, Giovanni
Hi, I noticed that time ago the fixed
attribute was removed from model NamespaceModel.
However, it is still referenced in class NamespaceAdmin, so that the associated form is broken in the admin UI.
Best, Giovanni
BaseCommand.option_list
was deprecated in Django 1.8. As of that version, management commands are supposed to override the add_arguments
method instead:
This breaks the rdf_export
and rdf_import
commands in Django 2+.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.