Bug 18586 - Create module to mint RDF subject URIs
Summary: Create module to mint RDF subject URIs
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 10662 10788 18713
  Show dependency treegraph
 
Reported: 2017-05-12 06:49 UTC by David Cook
Modified: 2018-05-03 21:05 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 18586 - Create module to mint RDF subject URIs (3.85 KB, patch)
2017-05-23 02:31 UTC, David Cook
Details | Diff | Splinter Review
Bug 18586 - Create module to mint RDF subject URIs (3.98 KB, patch)
2017-05-23 09:52 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 18586 - Create module to mint RDF subject URIs (4.04 KB, patch)
2017-06-16 17:16 UTC, Brendan Gallagher
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2017-05-12 06:49:54 UTC
In the relational database, we use biblionumber as the ID for bibliographic records, but a triplestore we need to use a RDF URI. So I'm going to put together a module with a little method for minting URIs.

While we could just agree on a convention, it probably makes sense to use the convention in the module and then use the module elsewhere to keep things consistent.
Comment 1 David Cook 2017-05-22 05:43:29 UTC
I've been thinking that it might be worthwhile to mint a URI and then store it in a database table.

Even if we moved all the metadata for a bibliographic record into a triplestore, we'd still be storing transactional information in the relational database. So we're still going to have a biblionumber in the relational database. If we store the RDF URI in the RDBMS, we gain a certain robustness in the event that someone changes a system preference containing the URI syntax used for minting. 

I mean... if they changed the syntax, it could break the ability to dereference those old URIs, but it's still valid RDF even if you can't dereference it. Plus hopefully they'd fix it so that you could still dereference it (ideally through a redirect I reckon).
Comment 2 David Cook 2017-05-22 07:04:51 UTC
I've created a Koha::RDF module and a mint_uri() method. It just creates and returns the URI string using the URI module. I've also added some tests for it.

I think saving it to the database will be part of AddBiblio and/or ModBiblio. Some thinking to do about how best to optimally add the URI to the database. Off the top of my head, I'd want to save it at AddBiblio time, but you'd want to be able to update existing biblios... so if you do ModBiblio,  you could just run touch_all_biblios.pl. Anyway, it's 5:04pm, so that's another day.

I'll post the code tomorrow morning.
Comment 3 David Cook 2017-05-23 02:31:45 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2017-05-23 09:52:59 UTC
Created attachment 63645 [details] [review]
Bug 18586 - Create module to mint RDF subject URIs

Created the Koha::RDF module to mint URIs for RDF documents that
represent Koha bibliographic records.

_TEST PLAN_
To test the module, just run 'prove t/Koha/RDF.t'.

You'll get
some warnings about not being able to find koha-conf.xml, but
you can safely ignore them or you can point to any koha-conf.xml
file since it's not used by the test in actuality.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as expected. No warnings when run like:
sudo koha-shell -c "prove t/Koha/RDF.t" kohadev
Comment 5 Brendan Gallagher 2017-06-16 17:16:27 UTC
Created attachment 64406 [details] [review]
Bug 18586 - Create module to mint RDF subject URIs

Created the Koha::RDF module to mint URIs for RDF documents that
represent Koha bibliographic records.

_TEST PLAN_
To test the module, just run 'prove t/Koha/RDF.t'.

You'll get
some warnings about not being able to find koha-conf.xml, but
you can safely ignore them or you can point to any koha-conf.xml
file since it's not used by the test in actuality.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as expected. No warnings when run like:
sudo koha-shell -c "prove t/Koha/RDF.t" kohadev

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Comment 6 Jonathan Druart 2018-05-03 17:26:50 UTC
I know this is waiting for a long time, but does it make sense to have it pushed without other related patches?

Alone it will not bring anything to our codebase.
Comment 7 Magnus Enger 2018-05-03 21:05:29 UTC
(In reply to Jonathan Druart from comment #6)
> I know this is waiting for a long time, but does it make sense to have it
> pushed without other related patches?

I would say it can wait. (But it would be excellent to have it in master early in the 18.11 iteration, I'll start using it sometime after summer :-)