From dade877e7f3982ac949564271037d730d6284d35 Mon Sep 17 00:00:00 2001 From: amita singh Date: Fri, 1 Jun 2012 12:44:17 +0530 Subject: gstudio_rdffile_path added in settings.py --- demo/settings.py | 12 ++++++++++++ gstudio/management/commands/dump_all_rdf.py | 16 ++++++++-------- gstudio/management/commands/generate_all_rdf.py | 2 +- setup.py | 3 +++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/demo/settings.py b/demo/settings.py index 96de64f..8e82adf 100644 --- a/demo/settings.py +++ b/demo/settings.py @@ -98,6 +98,7 @@ GRAPPELLI_ADMIN_TITLE = 'Gnowledge Studio' GRAPPELLI_INDEX_DASHBOARD = "demo.dashboard.CustomIndexDashboard" +GSTUDIO_RDF_FILEPATH = os.path.join(os.path.dirname(__file__), 'rdffiles.rdf') # Authentication related ACCOUNT_ACTIVATION_DAYS = 2 @@ -105,6 +106,14 @@ EMAIL_HOST = 'localhost' DEFAULT_FROM_EMAIL = 'webmaster@localhost' LOGIN_REDIRECT_URL = '/' +# fourstore related +FOURSTORE_KBNAME = "demo" # Name of 4store knowledge base +FOURSTORE_PORT = 8067 # Port for 4store HTTP server +SPARQL_ENDPOINT = "http://localhost:8067/sparql/" + + + + LANGUAGES = (('en', gettext('English')), @@ -173,6 +182,9 @@ INSTALLED_APPS = ( 'registration', 'graphviz', 'demo', + 'fourstore', + 'HTTP4Store', + 'html5lib', # Uncomment the south entry to activate south for database migrations # Please do install south before uncommenting # command: sudo pip install south diff --git a/gstudio/management/commands/dump_all_rdf.py b/gstudio/management/commands/dump_all_rdf.py index dffcd70..c2d21b7 100644 --- a/gstudio/management/commands/dump_all_rdf.py +++ b/gstudio/management/commands/dump_all_rdf.py @@ -9,6 +9,8 @@ from rdflib.term import URIRef from tempfile import mkdtemp from gstudio.models import * from objectapp.models import * +import settings +import os.path from django.core.management.base import NoArgsCommand from django.core.management.base import BaseCommand @@ -19,7 +21,7 @@ def rdf_all(notation='xml'): """ valid_formats = ["xml", "n3", "ntriples", "trix"] default_graph_uri = "http://gstudio.gnowledge.org/rdfstore" - # default_graph_uri = "http://example.com/" + configString = "/var/tmp/rdfstore" # Get the IOMemory plugin. @@ -40,8 +42,7 @@ def rdf_all(notation='xml'): # Now we'll add some triples to the graph & commit the changes - #rdflib = Namespace('http://sbox.gnowledge.org/gstudio/') - rdflib = Namespace('http://example.com/') + graph.bind("gstudio", "http://gnowledge.org/") exclusion_fields = ["id", "rght", "node_ptr_id", "image", "lft", "_state", "_altnames_cache", "_tags_cache", "nid_ptr_id", "_mptt_cached_fields"] @@ -133,8 +134,10 @@ def rdf_all(notation='xml'): graph.add((rdflib[subject], rdflib[predicate], Literal(pobject))) rdf_code=graph.serialize(format=notation) - - temp_path = '/home/labadmin/dev/gnowsys-studio/demo/newfiles/' + 'rdfdata'+'.rdf' + #path to store the rdf in a file + + x = os.path.join(os.path.dirname(__file__), 'rdffiles.rdf') + temp_path=str(x) file = open(temp_path, 'w') file.write(rdf_code) file.close() @@ -159,9 +162,6 @@ def link(node): return rdflib -#makes individual rdf file for nodes. - - diff --git a/gstudio/management/commands/generate_all_rdf.py b/gstudio/management/commands/generate_all_rdf.py index bc57286..a504a00 100644 --- a/gstudio/management/commands/generate_all_rdf.py +++ b/gstudio/management/commands/generate_all_rdf.py @@ -168,7 +168,7 @@ def link(node): class Command(BaseCommand): def handle(self,*args,**options): - # verify the type of the node and pass the node to display the rdf accordingly. + # verifies and pass the node rdf_discription() to display the rdf accordingly. inr=0 diff --git a/setup.py b/setup.py index 4e12238..95de8f2 100644 --- a/setup.py +++ b/setup.py @@ -105,6 +105,9 @@ setup(name='django-gstudio', 'django-ratings>=0.3.6', 'rdflib>=3.0.0', 'django-registration>=0.8', + 'django-4store>=0.3', + 'HTTP4Store>=0.2', + 'html5lib>=0.95', ]) -- cgit v1.1