- DatasetExtension.php save also Reference for datacite and dublin_core transformations

- oai:datacite.xslt für relatedIdentifiers
- oai: dc: datasetxml2oai-pmh.xslt für dc:relation
- dataset.php correct hasEmbargoPassed() method
This commit is contained in:
Arno Kaimbacher 2020-03-05 13:40:09 +01:00
parent fd98c6c09d
commit c0022e3c1c
4 changed files with 36 additions and 2 deletions

View File

@ -6,9 +6,9 @@ use App\Models\Description;
use App\Models\License; use App\Models\License;
use App\Models\Person; use App\Models\Person;
use App\Models\File; use App\Models\File;
use App\Models\GeolocationBox;
use App\Models\Coverage; use App\Models\Coverage;
use App\Models\Subject; use App\Models\Subject;
use App\Models\DatasetReference;
/** /**
* DatasetExtension short summary. * DatasetExtension short summary.
@ -65,6 +65,11 @@ trait DatasetExtension
'relation' => 'persons', 'relation' => 'persons',
'fetch' => 'eager' 'fetch' => 'eager'
), ),
'Reference' => array(
'model' => DatasetReference::class,
'relation' => 'references',
'fetch' => 'eager'
),
'Subject' => array( 'Subject' => array(
'model' => Subject::class, 'model' => Subject::class,
'relation' => 'subjects', 'relation' => 'subjects',

View File

@ -306,7 +306,8 @@ class Dataset extends Model
$embargoDate->minute = 59; $embargoDate->minute = 59;
$embargoDate->second = 59; $embargoDate->second = 59;
return ($embargoDate->gt($now) == true); return ($embargoDate->lessThan($now));
//return ($embargoDate->gt($now) == true);
} }
public function getRemainingTimeAttribute() public function getRemainingTimeAttribute()

View File

@ -354,6 +354,8 @@
<xsl:apply-templates select="@Language" mode="oai_dc" /> <xsl:apply-templates select="@Language" mode="oai_dc" />
<!-- dc:rights --> <!-- dc:rights -->
<xsl:apply-templates select="Licence" mode="oai_dc" /> <xsl:apply-templates select="Licence" mode="oai_dc" />
<!-- dc:relation -->
<xsl:apply-templates select="Reference" mode="oai_dc" />
<!-- dc:coverage --> <!-- dc:coverage -->
<xsl:apply-templates select="Coverage" mode="oai_dc" /> <xsl:apply-templates select="Coverage" mode="oai_dc" />
</oai_dc:dc> </oai_dc:dc>
@ -401,6 +403,7 @@
<xsl:value-of select="@Value"/> <xsl:value-of select="@Value"/>
</dc:title> </dc:title>
</xsl:template> </xsl:template>
<xsl:template match="TitleAdditional" mode="oai_dc"> <xsl:template match="TitleAdditional" mode="oai_dc">
<dc:title> <dc:title>
<xsl:value-of select="@Value"/> <xsl:value-of select="@Value"/>
@ -435,6 +438,14 @@
</dc:subject> </dc:subject>
</xsl:template> </xsl:template>
<xsl:template match="Reference" mode="oai_dc">
<dc:relation>
<xsl:value-of select="@Value" />
</dc:relation>
</xsl:template>
<xsl:template match="PersonAuthor|PersonEditor" mode="oai_dc"> <xsl:template match="PersonAuthor|PersonEditor" mode="oai_dc">
<dc:creator> <dc:creator>
<xsl:value-of select="@LastName" /> <xsl:value-of select="@LastName" />

View File

@ -77,6 +77,11 @@
<xsl:text>Dataset</xsl:text> <xsl:text>Dataset</xsl:text>
<!-- <xsl:value-of select="@Type" /> --> <!-- <xsl:value-of select="@Type" /> -->
</resourceType> </resourceType>
<xsl:if test="Reference">
<relatedIdentifiers>
<xsl:apply-templates select="Reference" mode="oai_datacite" />
</relatedIdentifiers>
</xsl:if>
<rightsList> <rightsList>
<xsl:apply-templates select="Licence" mode="oai_datacite" /> <xsl:apply-templates select="Licence" mode="oai_datacite" />
</rightsList> </rightsList>
@ -195,6 +200,18 @@
</subject> </subject>
</xsl:template> </xsl:template>
<xsl:template match="Reference" mode="oai_datacite">
<relatedIdentifier>
<xsl:attribute name="relatedIdentifierType">
<xsl:value-of select="@Type" />
</xsl:attribute>
<xsl:attribute name="relationType">
<xsl:value-of select="@Relation" />
</xsl:attribute>
<xsl:value-of select="@Value" />
</relatedIdentifier>
</xsl:template>
<xsl:template match="PersonContributor" mode="oai_datacite"> <xsl:template match="PersonContributor" mode="oai_datacite">
<contributor> <contributor>
<contributorName> <contributorName>