• Topic
  • Discussion
  • ODS.OdsBriefcaseGoogleDrive(1.2) -- DAVWikiAdmin? , 2018-01-02 11:00:39 Edit WebDAV System Administrator 2018-01-02 11:00:39

    Using ODS-Briefcase to mediate access to data stored in Google Drive

    Introduction

    Google Drive is a way to store your files on Google's servers, or in the Cloud. If you run the free Google Drive application, then you get a folder on your computer (Windows or Mac OS X) that looks just like a directory on your hard disk that you can drag your files in to. Anything stored in that folder is kept on your hard disk and is also copied to your account in the cloud. You can access those files through drive.google.com or from other computers, including mobile devices.

    Google Drive file storage offers users a number of features:

    • flexibility: the synchronization can be performed from different devices or using the web version.
    • free 5 MB storage by default: can be extended with pay option
    • usable as backup service
    • your resources are encrypted

    ODS Briefcase offers a new "GDrive" folder type which provides several additional features, once the ODS system is configured with a registered Google API key and secret pair:

    • Specify credentials for authentication against Google Drive, enabling retrieval of any or all of your folders and files, including any associated metadata
    • Specify which Sponger Extractor Cartridges and Sponger Meta Cartridges should be run against your GDrive data
    • Save fetched data, metadata, and Sponger output, into a newly created GDrive-specific RDF Graph in the Virtuoso RDF Quad Store
    • Specify other ODS Users or WebID-based ACLs which should be granted access to your GDrive data through ODS Briefcase

    Example

    Here is a sample scenario showing the whole process, from setting the Google Drive API key and secret pair in ODS, to retrieving all Google Drive content to ODS Briefcase.

    Prerequisites

    Steps

    1 - Get a Google Drive API key and secret pair for use with ODS-Briefcase

    Note that at present, each Virtuoso + ODS instance can only be configured with a single Google Drive API key, which will then be used by all ODS-Briefcase users when targeting Google Drive from that instance. Google imposes limitations on the API key's use (currently set to 500,000 requests/day). This limitation is outside the scope of OpenLink or Virtuoso control.
    1. Browse to <the Google APIs Console>, and log in with your existing Google user credentials:



    2. If this is your first Google API Project, click the big Create Project button:



    3. If you already have some Google API Projects, select Create Project from the Project menu.
    4. You should now be on the Services tab for your new API Project (or you can click to it). Click the Drive API switch, to change it from OFF to ON:



    5. If prompted, agree to the Google APIs Terms of Service:



    6. The Drive API switch should now show ON. Click API Access in the upper-left navigation area:



    7. Click Create an OAuth 2.0 client ID...:



    8. On the Branding Information pane, enter a "Product name" for your GDrive client application (i.e., your ODS-Briefcase instance) to be known by, e.g., "MyODSGoogleDrive". You can also associate an logo with it, if you like. Then click Next:



    9. On the Client ID Settings pane, leave the default Web application for Application type. Click the more options link for Your site or hostname:



    10. For Authorized Redirect URIs, put your ODS instance's Google interface URL, http://<host>[:<port>]/ods/access_google.vsp, e.g., <http://example.com/ods/access_google.vsp>. For Authorized JavaScript? Origins, put the root URI of your Virtuoso instance, <http://example.com>. For best results, include URLs using both http and https schemes. Click Create client ID:



    11. Your new OAuth 2.0 ID will now be displayed, in a new Client ID for web applications section. The Email address and Client secret shown here are your Google API Key and Secret:



    12. You may wish to use the API Project menu's Rename... option to change this project's name -- especially if you may create more than one project over time.



    13. This example project, renamed:



    2 - Configure ODS to use your Google API key and secret

    1. Browse to your Virtuoso + ODS instance, http://<cname>[:<port>]/ods, e.g., <http://example.com/ods/>, and click Sign In.



    2. Log in as a Virtuoso+ODS user with Administrator privileges, e.g., dba.



    3. Click on Site Settings:



    4. Click on Login Authentication Keys:



    5. Select Google API in the API Name menu, provide the Email address and Client secret from the new Client ID for web applications you created above, and click Add.



    6. ODS-Briefcase is now configured to use the Google API.



    3 - Access files stored on Google Drive through ODS-Briefcase

    1. Browse to your Virtuoso + ODS instance, http://<cname>[:<port>]/ods, e.g., <http://example.com/ods/>.



    2. Log in as a Virtuoso+ODS user with normal privileges, e.g., demo.



    3. Click to the ODS-Briefcase application:



    4. Click New Folder from the main Briefcase control strip:



    5. In the New Folder form, specify a Folder Name, e.g., MyGoogleDriveFolder, and set the Folder type to Google Drive:



    6. Click to the newly visible Google Drive tab:



    7. All RDF data extracted from and otherwise collected about your Google Drive files will be saved to a named graph, where the default name is constructed from the host ODS instance, the ODS username, and the Briefcase folder name -- http://<host>[:<port>]/DAV/home/<user-name>/<folder-name>#this -- so, in this example, the default graph would be named <http://example.com/ods/demo/MyGoogleDriveFolder#this>. Expert users may wish to change this graph name, but the default is suitable for most users.



    8. You can also turn on the Virtuoso Sponger, to process your Google Drive files more comprehensively. When the Sponger is enabled for your folder, you can specify which "Sponger Extractor Cartridges" and "Sponger Meta Cartridges" will be run over the files in your Google Drive. You can enable all cartridges, but this will introduce some processing overhead. It's generally best to enable only those cartridges which will be applicable to your files and their content. For instance, you may know that you'll only be storing Microsoft and Open Office documents here. Then, click "Authenticate", to connect your new folder to your Google Drive:



    9. You'll be prompted to enter your Google Drive user's credentials. Note that this Google Drive user need not be the application owner/"developer" who got the API key earlier.



    10. Google will prompt for confirmation that you intend to let your application ("MyODSGoogleDrive?") have access to your Google Drive content. Click Allow access.



    11. Your Google user name and associated email address will now be displayed. Click Create to finish the folder creation process.



    12. Your new Google Drive-linked folder should now be displayed in your Briefcase resources list:



    13. Click the folder name to see the resources ODS-Briefcase has found in your Google Drive Dataspace:



    Related