Active
Project:
Neologism
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Aug 2011 at 19:22 UTC
Updated:
17 Aug 2011 at 23:25 UTC
This task was outlined in the project timeline at #1151286: Proposed Timeline for D7 Port as :
Provide the feature of importing and loading vocabulary by using the evoc module code
Comments
Comment #1
cygri commentedThere are actually two parts to importing.
First, importing some vocabulary from the web or from a file in order to edit and host it in Neologism. For example, I might start developing an ontology in Protégé, and then decide to load it into Neologism so that it's nicely available on the web.
Second, loading an existing external vocabulary into Neologism so that one can use its classes and properties as superclasses/superproperties and so on. For example, I might load the FoaF vocabulary so that I can declare the my:Employee class in my own vocabulary as a subclass of foaf:Person.
I think we should initially focus on the first scenario. Both scenarios will share a lot of code but are also different: the first creates a new workspace; the second adds a non-main vocabulary to an existing workspace.
I'm going to describe how the first scenario is implemented in the D6 version.
neologism/importinhook_menuneologism_import_form_callbackinneologism.import.incneologism_import_form; ignore the first part of the bigifblock; you only need the part starting hereneologism_import_form_validateperforms validation of the entered values, and as part of that actually loads and parses the vocabulary (more on that later); the parsed vocabulary is temporarily stored in$form_state['neologism_processed_vocabulary']where the submit handler will find it again; you can ignore the part at “// Handle undefined namespaces”neologism_import_form_submitand uses a number of additional functions in theneologism.import.incfileevoc_get_from_fileandevoc_get_from_file; both are defined inevoc.load_vocab.incwhich is part of theevocmoduleevoc.load_vocab.inccan be re-used without much change; I'd say just keep copying functions over to the new codebase until it no longer complains about undefined functions…evoc.load_vocab.incroughly has two parts; the first half is concerned with loading and parsing the various formats; the second part (starting withevoc_get_from_file) is concerned with extracting RDFS and OWL schema information from the parsed RDF graphHope that helps!