diff options
Diffstat (limited to 'schema/parse.py')
-rw-r--r-- | schema/parse.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/schema/parse.py b/schema/parse.py index 22f88645..36d09466 100644 --- a/schema/parse.py +++ b/schema/parse.py @@ -1,6 +1,15 @@ # Load Baserock Definitions serialisation format V5 into a SurfRDF 'store'. -# https://github.com/cosminbasca/surfrdf +# SurfRDF: https://github.com/cosminbasca/surfrdf + +# I've now decided that using RDFLib (a lower-level library used by SurfRDF) +# directly would be just as simple as using the object-mapping provided by +# SurfRDF. The rdflib.resource.Resource class is actually a pretty good +# object-mapper itself, if we want one. + +# Note that neither surf.Resource nor rdflib.resource.Resource do any +# validation of what properties you set according to the schema. You can +# set chunk.baserock_dogfood='http://delicious' if you want. import rdflib @@ -59,7 +68,7 @@ def load_all_morphologies(session, store, path='.'): chunk_uri = base_uri + 'chunks/' + contents['name'] entity = chunk = Chunk(chunk_uri) - # FIXME: I think order is lost here !!!!! + # FIXME: order is lost here !!!!! if 'pre-configure-commands' in contents: chunk.baserock_preConfigureCommands = contents['pre-configure-commands'] if 'configure-commands' in contents: @@ -169,8 +178,6 @@ def load_all_morphologies(session, store, path='.'): deployments = [] for entry in contents.get('systems', []): - # FIXME: can't get the URI from the 'morph' entry... need to load - # the actual .morph file and get the name from there. system_morph_file = os.path.join(toplevel_path, entry['morph']) system_name = get_name_from_morph_file(system_morph_file) system_uri = base_uri + 'systems/' + system_name @@ -223,16 +230,19 @@ def load_all_morphologies(session, store, path='.'): try: session.commit() except Exception as e: + # Special handler for a common error case when trying to insert data + # into a fresh install of the Virtuoso database... hopefully this saves + # someone time! if 'Virtuoso 42000 Error SR186: No permission to execute procedure DB' in e.message: print("Permission denied trying to update the database via the " - "SPARQL endpoint. By default this endpoint is read-only. " - "To enable write access, run the `isql` or `isql-vt` " - "commandline interface and run the following statement:\n\n" - " grant SPARQL_UPDATE to \"SPARQL\";\n\n" - "WARNING! Only do this if you're using a local test instance " - "of Virtuoso. You need to set up a real authenticated user " - "account if using an instance of Virtuoso that has " - "important data on it.") + "SPARQL endpoint. By default this endpoint is read-only. " + "To enable write access, run the `isql` or `isql-vt` " + "commandline interface and run the following statement:\n\n" + " grant SPARQL_UPDATE to \"SPARQL\";\n\n" + "WARNING! Only do this if you're using a local test instance " + "of Virtuoso. You need to set up a real authenticated user " + "account if using an instance of Virtuoso that has " + "important data on it.") else: raise |