Skip to content
This repository was archived by the owner on Mar 18, 2020. It is now read-only.

Commit eca54ad

Browse files
lsitumcritchlow
authored andcommitted
Mapped TERMSANDCONDITIONS to Copyright status instead of copyright note.
1 parent 3783c03 commit eca54ad

8 files changed

Lines changed: 29 additions & 18 deletions

File tree

src/edu/ucsd/library/xdre/harvesting/CilHarvesting.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,12 @@ record = new TabularRecord();
147147
}
148148

149149
if (record != null) {
150-
// Ignore copyrighted records (copyright note: copyright)
151-
String copyrightNote = record.getData().remove(FieldMappings.COPYRIGHT_NOTE);
152-
if (StringUtils.isNotBlank(copyrightNote)) {
153-
if (copyrightNote.equalsIgnoreCase(COPYRIGHT_TEXT)) {
150+
// Ignore copyrighted records (copyrightStatus: copyright)
151+
String copyrightStatus = record.getData().get(FieldMappings.COPYRIGHT_STATUS.toLowerCase());
152+
if (StringUtils.isNotBlank(copyrightStatus)) {
153+
if (copyrightStatus.equalsIgnoreCase(COPYRIGHT_TEXT)) {
154154
return nextRecord();
155155
}
156-
157-
// Use copyrightNote header that is used in batch export/overlay
158-
record.getData().put(TabularRecord.COPYRIGHT_NOTE, copyrightNote);
159156
}
160157
}
161158

src/edu/ucsd/library/xdre/harvesting/FieldMappings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
public class FieldMappings
2727
{
2828

29-
public static final String COPYRIGHT_NOTE = "copyright note";
29+
public static final String COPYRIGHT_STATUS = "copyrightStatus";
3030
public static final String TITLE = "title";
3131
public static final String DATE_CREATION = "date:creation";
3232
public static final String BEGIN_DATE = "Begin date";
765 KB
Binary file not shown.

src/resources/dams42json.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@
321321
</xsl:template>
322322

323323
<xsl:template name="damsCopyright" match="dams:Copyright">
324-
<xsl:for-each select="dams:copyrightNote">
324+
<xsl:for-each select="dams:copyrightStatus">
325325
<xsl:call-template name="appendJsonObject">
326-
<xsl:with-param name="key">copyright note</xsl:with-param>
326+
<xsl:with-param name="key">Copyright status</xsl:with-param>
327327
<xsl:with-param name="val"><xsl:value-of select="."/></xsl:with-param>
328328
</xsl:call-template>
329329
</xsl:for-each>

test/edu/ucsd/library/xdre/harvesting/CilHavestingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ public void testExtractCopyrightNode() throws Exception {
5959
String[] files = {createJsonDataFile("test123.json").getAbsolutePath()};
6060
CilHarvesting cilHarvesting = new CilHarvesting(fieldMappings, constantFields, Arrays.asList(files));
6161
TabularRecord rec = (TabularRecord) cilHarvesting.nextRecord();
62-
assertEquals("CopyrightNote does't match.", "attribution_nc_sa", rec.getData().get(TabularRecord.COPYRIGHT_NOTE.toLowerCase()));
62+
assertEquals("CopyrightStatus does't match.", "attribution_nc_sa", rec.getData().get(TabularRecord.COPYRIGHT_STATUS.toLowerCase()));
6363

6464
Document doc = rec.toRDFXML();
65-
assertEquals("attribution_nc_sa", doc.valueOf("//dams:Object/dams:copyright//dams:copyrightNote"));
65+
assertEquals("attribution_nc_sa", doc.valueOf("//dams:Object/dams:copyright//dams:copyrightStatus"));
6666
}
6767

6868
@Test

test/edu/ucsd/library/xdre/harvesting/CilHavestingTestBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ protected Map<String, List<String>> initiateFiledMappings() {
262262
String[] identifierFields = {OBJECT_UNIQUE_ID, FieldMappings.IDENTIFIER_SAMPLENUMBER};
263263
fieldMappings.put(SOURCE_IDENTIFIER.toLowerCase(), Arrays.asList(identifierFields));
264264

265-
String[] copyrightNoteFields = {TabularRecord.COPYRIGHT_NOTE};
266-
fieldMappings.put(SOURCE_TERMSANDCONDITIONS_FREE_TEXT.toLowerCase(), Arrays.asList(copyrightNoteFields));
265+
String[] copyrightStatusFields = {TabularRecord.COPYRIGHT_STATUS};
266+
fieldMappings.put(SOURCE_TERMSANDCONDITIONS_FREE_TEXT.toLowerCase(), Arrays.asList(copyrightStatusFields));
267267

268268
String[] fileNameFields = {FieldMappings.FILE_NAME};
269269
fieldMappings.put(FieldMappings.SOURCE_IMAGE_FILE_PATH.toLowerCase(), Arrays.asList(fileNameFields));
788 KB
Binary file not shown.

test/resources/dams42json.xsl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<xsl:template match="rdf:RDF">
1313
<xsl:call-template name="startJsonObject"/>
1414

15-
<xsl:for-each select="*">
15+
<xsl:for-each select="*[local-name() != 'DAMSEvent']">
1616
<xsl:variable name="id"><xsl:value-of select="@rdf:about"/></xsl:variable>
1717
<xsl:variable name="count"><xsl:number level="any" count="dams:Object"/></xsl:variable>
1818
<xsl:variable name="objectId">
@@ -134,6 +134,10 @@
134134
<xsl:for-each select="*[local-name()='cartographics']">
135135
<xsl:apply-templates />
136136
</xsl:for-each>
137+
138+
<xsl:for-each select="*[local-name()='copyright']">
139+
<xsl:apply-templates />
140+
</xsl:for-each>
137141
</xsl:template>
138142

139143
<xsl:template name="madsTitle" match="mads:Title">
@@ -297,7 +301,7 @@
297301
<xsl:template name="damsRelatedResource" match="dams:RelatedResource">
298302
<xsl:call-template name="appendJsonObject">
299303
<xsl:with-param name="key">Related resource:<xsl:value-of select="dams:type"/></xsl:with-param>
300-
<xsl:with-param name="val"><xsl:value-of select="dams:uri/@rdf:resource"/> @ <xsl:value-of select="dams:description"/></xsl:with-param>
304+
<xsl:with-param name="val"><xsl:value-of select="dams:description"/> @ <xsl:value-of select="dams:uri/@rdf:resource"/></xsl:with-param>
301305
</xsl:call-template>
302306
</xsl:template>
303307

@@ -316,6 +320,15 @@
316320
</xsl:for-each>
317321
</xsl:template>
318322

323+
<xsl:template name="damsCopyright" match="dams:Copyright">
324+
<xsl:for-each select="dams:copyrightStatus">
325+
<xsl:call-template name="appendJsonObject">
326+
<xsl:with-param name="key">Copyright status</xsl:with-param>
327+
<xsl:with-param name="val"><xsl:value-of select="."/></xsl:with-param>
328+
</xsl:call-template>
329+
</xsl:for-each>
330+
</xsl:template>
331+
319332
<xsl:template name="damsResource">
320333
<xsl:value-of select="local-name()"/>
321334
</xsl:template>
@@ -366,8 +379,8 @@
366379
<xsl:with-param name="key">Level</xsl:with-param>
367380
<xsl:with-param name="val">
368381
<xsl:choose>
369-
<xsl:when test="$depth = '1'"> \Component</xsl:when>
370-
<xsl:otherwise> \Sub-component</xsl:otherwise>
382+
<xsl:when test="$depth = '1'">Component</xsl:when>
383+
<xsl:otherwise>Sub-component</xsl:otherwise>
371384
</xsl:choose>
372385
</xsl:with-param>
373386
</xsl:call-template>
@@ -377,6 +390,7 @@
377390
<xsl:for-each select="dams:hasComponent/dams:Component">
378391
<xsl:sort select="dams:order" data-type="number" order="ascending" />
379392
<xsl:call-template name="damsComponent">
393+
<xsl:with-param name="objectId"><xsl:value-of select="$objectId" /></xsl:with-param>
380394
<xsl:with-param name="depth"><xsl:value-of select="$depth + 1"/></xsl:with-param>
381395
</xsl:call-template>
382396
</xsl:for-each>

0 commit comments

Comments
 (0)