NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
41 stars 26 forks source link

Support EML dataTable entities #180

Closed csjx closed 6 years ago

csjx commented 7 years ago

This relates to #161 in that while we currently are creating otherEntity sections with associated entity and attribute metadata, the Arctic Data Center team is actively creating dataTable sections, and so we'll need to support editing of these in the 2.0.0 release. To do so, create the EMLDataTable class (modeled after EMLOtherEntity) and modify the appropriate calls to parse() so we handle data tables correctly.

csjx commented 7 years ago

I've added the EMLDataTable class and integrated it into EML211. Testing now.

csjx commented 7 years ago

In testing an existing EML document with dataTable entities, so far EMLDataTable.parse() is working correctly, and the editor is populated correctly. However, on Submit, there's a serialization issue with XML ids being used twice in the document. It looks like the new dataTable entities are being added rather than updating the old ones. I'm tracking that down now.

csjx commented 7 years ago

This is working now in that the EML is being updated correctly. However, there's an issue with the RDF being updated, which I'm tracking down:

Error: Statement to be removed is not on store: <https://cn.dataone.org/cn/v2/resolve/urn%3Auuid%3Aba9449d8-483d-446a-9530-b45005de2c16#aggregation> <http://purl.org/dc/terms/identifier> "adc.8.1#aggregation" .
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at n.<anonymous> (DataPackage.js?v=2.0.0RC1:1116)
    at underscore.js:73
    at Function.m.each.m.forEach (underscore.js:153)
    at n.serialize (DataPackage.js?v=2.0.0RC1:1114)
    at n.save (DataPackage.js?v=2.0.0RC1:588)
    at n.<anonymous> (backbone.js:328)
    at n.<anonymous> (underscore.js:890)
    at _ (backbone.js:369)
    at m (backbone.js:356)
DataPackage.js?v=2.0.0RC1:1118 

Error: RDFArrayRemove: Array did not contain <https://cn.dataone.org/cn/v2/resolve/urn%3Auuid%3Aba9449d8-483d-446a-9530-b45005de2c16#aggregation> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.openarchives.org/ore/terms/Aggregation> . <https://dev.christopherjones.co/metacat/d1/mn/v2/object/adc.8.1>
    at r (rdflib.min.js?v=2.0.0RC1:12)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at n.<anonymous> (DataPackage.js?v=2.0.0RC1:1116)
    at underscore.js:73
    at Function.m.each.m.forEach (underscore.js:153)
    at n.serialize (DataPackage.js?v=2.0.0RC1:1114)
    at n.save (DataPackage.js?v=2.0.0RC1:588)
    at n.<anonymous> (backbone.js:328)
    at n.<anonymous> (underscore.js:890)
DataPackage.js?v=2.0.0RC1:1118 

Error: RDFArrayRemove: Array did not contain <https://cn.dataone.org/cn/v2/resolve/urn%3Auuid%3Aba9449d8-483d-446a-9530-b45005de2c16#aggregation> <http://www.openarchives.org/ore/terms/aggregates> <https://cn.dataone.org/cn/v2/resolve/adc.5.1> . <https://dev.christopherjones.co/metacat/d1/mn/v2/object/adc.8.1>
    at r (rdflib.min.js?v=2.0.0RC1:12)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at n.<anonymous> (DataPackage.js?v=2.0.0RC1:1116)
    at underscore.js:73
    at Function.m.each.m.forEach (underscore.js:153)
    at n.serialize (DataPackage.js?v=2.0.0RC1:1114)
    at n.save (DataPackage.js?v=2.0.0RC1:588)
    at n.<anonymous> (backbone.js:328)
    at n.<anonymous> (underscore.js:890)
DataPackage.js?v=2.0.0RC1:1118 

Error: RDFArrayRemove: Array did not contain <https://cn.dataone.org/cn/v2/resolve/urn%3Auuid%3Aba9449d8-483d-446a-9530-b45005de2c16#aggregation> <http://www.openarchives.org/ore/terms/aggregates> <https://cn.dataone.org/cn/v2/resolve/adc.6.1> . <https://dev.christopherjones.co/metacat/d1/mn/v2/object/adc.8.1>
    at r (rdflib.min.js?v=2.0.0RC1:12)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at c.value (rdflib.min.js?v=2.0.0RC1:9)
    at n.<anonymous> (DataPackage.js?v=2.0.0RC1:1116)
    at underscore.js:73
    at Function.m.each.m.forEach (underscore.js:153)
    at n.serialize (DataPackage.js?v=2.0.0RC1:1114)
    at n.save (DataPackage.js?v=2.0.0RC1:588)
    at n.<anonymous> (backbone.js:328)
    at n.<anonymous> (underscore.js:890)
DataPackage.js?v=2.0.0RC1:591 
Serializing XML - Cant find statements for _:n0
csjx commented 7 years ago

The above error is happening because, during DataPackage.serialize(), we fail to update the dcterms:identifier statement for the aggregation, and so on subsequent calls to DataPackage.save(), the attempts to remove these statements fail. Fixing this now.

laurenwalker commented 6 years ago

Is this still an open issue for 2.0.0 RC 3?

csjx commented 6 years ago

I'm closing this issue since the functionality is there, and will open another ticket if I continue to see the issues given @gothub's commit's that fix RDF serialization.