Testing and fixes
This commit is contained in:
parent
81048172b2
commit
d3b599033a
2
out.json
2
out.json
|
@ -1 +1 @@
|
|||
{"metadata":{"upload_type":"other","creators":[{"name":"Rossi, Pietro, pietro.rossi@acme.org"},{"name":"Verdi, Luca, lica.verdi@amce.org"},{"name":"Bianchi, Elena"}],"contributors":[{"name":"Ferrari, Paolo, paolo.ferrari@acme.org","type":"Other"},{"name":"Russo, Pietro, pietro.russo@amce.org","type":"Other"},{"name":"Giorgino, Giorgio","type":"Other"}],"communities":[{"identifier":"blue-cloud"}],"grants":[{"id":"862409"}]},"doiurl":"https://doi.org/null"}
|
||||
{"metadata":{"upload_type":"other","publication_date":"2021-03-08T16:30:21.000774+0000","title":"A sample deliverable 4 Zenodo","creators":[{"name":"Candela Leonardo"},{"name":"Candela Leonardo"}],"description":"This is a sample deliverable created for testing the publish2Zenodo \r\nfacility","access_right":"open","license":"CC-BY-SA-4.0","keywords":["Text mining"],"related_identifiers":[{"identifier":"https://data-pre.d4science.org/ctlg/preVRE/a_sample_deliverable_4_zenodo","relation":"isCompiledBy"}],"contributors":[{"name":"Candela Leonardo","type":"Producer"},{"name":"Candela Leonardo","type":"DataCurator"},{"name":"D4Science","type":"HostingInstitution"}],"version":"1"},"doiurl":"https://doi.org/null"}
|
|
@ -294,12 +294,15 @@ public class Translator {
|
|||
JsonPath path=JsonPath.compile(mapping.getTargetPath().getValue());
|
||||
switch(mapping.getTargetPath().getType()) {
|
||||
case array :
|
||||
targetCtx.set(path, resultingValueList);
|
||||
targetCtx=targetCtx.set(path, resultingValueList);
|
||||
break;
|
||||
case map :
|
||||
|
||||
for(Map<String,Object> resultingTargetElements : resultingValueList) {
|
||||
log.debug("Applying "+resultingTargetElements+ " to "+mapping.getTargetPath());
|
||||
targetCtx.set(path, resultingTargetElements);
|
||||
for(Entry<String,Object> e:resultingTargetElements.entrySet())
|
||||
targetCtx=targetCtx.put(path, e.getKey(),e.getValue());
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class TargetPath {
|
|||
private ElementType type=ElementType.map;
|
||||
|
||||
@XmlAttribute(required=false)
|
||||
private Boolean append=false;
|
||||
private Boolean append=true;
|
||||
|
||||
@XmlValue
|
||||
private String value;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class OneHitTest {
|
|||
System.out.println("Publishing.. ");
|
||||
//Finalize
|
||||
|
||||
// System.out.println("DONE : "+client.publish(preview, item));
|
||||
System.out.println("DONE : "+client.publish(preview, item));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,43 +24,43 @@
|
|||
<targetElement>upload_type</targetElement>
|
||||
</mapping>
|
||||
|
||||
<mapping>
|
||||
<source> <!-- $.store.book[?(@.price < 10)] -->
|
||||
<value type="jsonPath">$.extras[?(@.key=='Deliverable Author')].value</value>
|
||||
</source>
|
||||
<targetPath append="false" type="array">$.metadata.creators</targetPath>
|
||||
<targetElement>name</targetElement>
|
||||
</mapping>
|
||||
<!-- <mapping> -->
|
||||
<!-- <source> -->
|
||||
<!-- <value type="jsonPath">$.extras[?(@.key=='Deliverable Author')].value</value> -->
|
||||
<!-- </source> -->
|
||||
<!-- <targetPath append="false" type="array">$.metadata.creators</targetPath> -->
|
||||
<!-- <targetElement>name</targetElement> -->
|
||||
<!-- </mapping> -->
|
||||
|
||||
|
||||
|
||||
<!-- Contributor -> {name : ... , type : 'other'} -->
|
||||
<mapping>
|
||||
<source>
|
||||
<value type="jsonPath">$.extras[?(@.key=='Deliverable Contributor')].value</value>
|
||||
</source>
|
||||
<targetPath append="false" type="array">$.metadata.contributors</targetPath>
|
||||
<targetElement>name</targetElement>
|
||||
<targetElement constant="Other">type</targetElement>
|
||||
</mapping>
|
||||
<!-- <mapping> -->
|
||||
<!-- <source> -->
|
||||
<!-- <value type="jsonPath">$.extras[?(@.key=='Deliverable Contributor')].value</value> -->
|
||||
<!-- </source> -->
|
||||
<!-- <targetPath append="false" type="array">$.metadata.contributors</targetPath> -->
|
||||
<!-- <targetElement>name</targetElement> -->
|
||||
<!-- <targetElement constant="Other">type</targetElement> -->
|
||||
<!-- </mapping> -->
|
||||
|
||||
|
||||
|
||||
<mapping>
|
||||
<source>
|
||||
<value type="constant">862409</value>
|
||||
</source>
|
||||
<targetPath type="array">$.metadata.grants</targetPath>
|
||||
<targetElement>id</targetElement>
|
||||
</mapping>
|
||||
<!-- <mapping> -->
|
||||
<!-- <source> -->
|
||||
<!-- <value type="constant">862409</value> -->
|
||||
<!-- </source> -->
|
||||
<!-- <targetPath type="array">$.metadata.grants</targetPath> -->
|
||||
<!-- <targetElement>id</targetElement> -->
|
||||
<!-- </mapping> -->
|
||||
|
||||
<mapping>
|
||||
<source>
|
||||
<value type="constant">blue-cloud</value>
|
||||
</source>
|
||||
<targetPath type="array">$.metadata.communities</targetPath>
|
||||
<targetElement>identifier</targetElement>
|
||||
</mapping>
|
||||
<!-- <mapping> -->
|
||||
<!-- <source> -->
|
||||
<!-- <value type="constant">blue-cloud</value> -->
|
||||
<!-- </source> -->
|
||||
<!-- <targetPath type="array">$.metadata.communities</targetPath> -->
|
||||
<!-- <targetElement>identifier</targetElement> -->
|
||||
<!-- </mapping> -->
|
||||
</mappings>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue