Skip to content

Commit

Permalink
QUED-93 adjust citatation styles and adds export section to download … (
Browse files Browse the repository at this point in the history
#38)

* QUED-93 adjust citatation styles and adds export section to download source files

* QUED-93 update content and add initial project DOI

* QUED-93 update import command in README file

* QUED-93 update to current content version

* fixed typo

* add download files given from dhi

* fixed typo No. -> no.

* QUED-93 update data and fix build

- switch to newest mycore-lts
- use ubuntu jammy to get newer sed version
- update cms data from testserver
- allow internal nuxt links with cms

* QUED-93 prepare DOI generation

* QUED-93 added last missing text

---------

Co-authored-by: Kathleen Neumann <[email protected]>
Co-authored-by: Sebastian Hofmann <[email protected]>
  • Loading branch information
3 people authored Aug 3, 2023
1 parent 3e19d78 commit cf6dc21
Show file tree
Hide file tree
Showing 32 changed files with 8,403 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Starts the frontend with live changes
copy the current regest files from `import` to `docker/backend-tmp/import`
At localhost:8000/backend/ you can login and start the webcli and run the command:
```
import regests from cei file /mcr/tmp/import/2023-03-03_regesten_gesamt_red_vi-22.xml and source /mcr/tmp/import/2023-03-03_02_quellen-_und_literaturverzeichnis_regesten_red_viii.csv and manuscript /mcr/tmp/import/2023-03-03_01_hss-verzeichnis_regesten_red_vi.csv
import regests from cei file /mcr/tmp/import/2023-07-26_regesten_gesamt_red_vii-03.xml and source /mcr/tmp/import/2023-07-26_02_quellen-_und_literaturverzeichnis_regesten_red_xi.csv and manuscript /mcr/tmp/import/2023-07-26_01_hss-verzeichnis_regesten_red_vi-04.csv
```

## delete old content
Expand Down
2 changes: 1 addition & 1 deletion edition-archive-backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY --chown=maven:maven edition-archive-backend-module /opt/edition-archive-bac
COPY --chown=maven:maven edition-archive-backend-webapp /opt/edition-archive-backend/edition-archive-backend-webapp
RUN mvn --version && \
mvn clean install -DskipTests
FROM tomcat:jdk17-temurin-focal
FROM tomcat:10-jdk17-temurin-jammy
COPY --from=maven --chown=root:root /opt/edition-archive-backend/edition-archive-backend-webapp/target/edition-archive-backend-0.1-SNAPSHOT.war webapps/backend.war
COPY --from=maven --chown=root:root /opt/edition-archive-backend/edition-archive-backend-cli/target/edition-archive-backend-cli-0.1-SNAPSHOT.tar.gz /opt/mycore/cli.tar.gz
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ public class Regest {

private String ueberlieferungsform;

private String doi;

public String getDoi() {
return doi;
}

public void setDoi(String doi) {
this.doi = doi;
}

public String getUeberlieferungsform() {
return ueberlieferungsform;
}
Expand Down Expand Up @@ -133,6 +143,7 @@ public List<EntityLink> getBodyOrganizations() {
public String toString() {
return "Regest{" +
"idno='" + idno + '\'' +
", doi=" + doi +
", deliveryForm=" + deliveryForm +
", issued=" + issued +
", issuedPlace='" + issuedPlace + '\'' +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package de.gbv.metadata.pi;

import java.net.URI;
import java.net.URISyntaxException;

import org.mycore.datamodel.metadata.MCRBase;
import org.mycore.datamodel.metadata.MCRObject;
import org.mycore.pi.doi.MCRDOIService;

import de.gbv.metadata.MetaJSONHelper;
import de.gbv.metadata.model.Regest;

public class GPODOIService extends MCRDOIService {

@Override
public URI getRegisteredURI(MCRBase base) throws URISyntaxException {
String registerURL = getRegisterURL();
if (!(base instanceof MCRObject obj)) {
throw new IllegalArgumentException("Only MCRObjects are supported");
}

Regest regest = MetaJSONHelper.getMetaJsonObject(obj, "regest");
String idno = regest.getIdno();

return new URI(registerURL + idno);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package de.gbv.metadata.pi;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.Namespace;
import org.jdom2.Text;
import org.jdom2.filter.Filters;
import org.jdom2.input.SAXBuilder;
import org.jdom2.xpath.XPathExpression;
import org.jdom2.xpath.XPathFactory;
import org.mycore.common.MCRClassTools;
import org.mycore.common.MCRConstants;
import org.mycore.common.MCRException;
import org.mycore.common.content.MCRContent;
import org.mycore.common.content.MCRJDOMContent;
import org.mycore.common.content.transformer.MCRContentTransformer;
import org.mycore.datamodel.metadata.MCRObject;
import org.mycore.datamodel.metadata.MetaJSON;
import org.xml.sax.SAXException;

import de.gbv.metadata.MetaJSONHelper;
import de.gbv.metadata.model.Regest;

public class GPODataciteTransformer extends MCRContentTransformer {
private static Regest loadRegest(MCRContent mcrContent) throws IOException {
MCRObject object;

try {
Document xml = mcrContent.asXML();
object = new MCRObject(xml);
} catch (JDOMException | SAXException e) {
throw new MCRException(e);
}

Regest regest = MetaJSONHelper.getMetaJsonObject(object, "regest");
return regest;
}

private static Document loadTemplate() {
try (InputStream templateStream
= MCRClassTools.getClassLoader().getResourceAsStream("reims-gpo-doi-template.xml")) {
SAXBuilder saxBuilder = new SAXBuilder();
return saxBuilder.build(templateStream);
} catch (IOException | JDOMException e) {
throw new MCRException("Could not load template", e);
}
}

@Override
public MCRContent transform(MCRContent mcrContent) throws IOException {
Regest regestObject = loadRegest(mcrContent);
Document template = loadTemplate();


getXpathSingleElement(template, "/datacite:resource/datacite:identifier").setText(regestObject.getDoi());
getXpathElements(template.getRootElement(), ".//datacite:nrReplace").forEach(e-> {
int i = e.getParent().indexOf(e);
e.getParent().addContent(i, new Text(regestObject.getIdno()));
e.detach();
});

return new MCRJDOMContent(template);
}

public Element getXpathSingleElement(Document element, String xpath) {
XPathExpression<Element> expr
= XPathFactory.instance().compile(xpath, Filters.element(), null, MCRConstants.XLINK_NAMESPACE,
Namespace.getNamespace("datacite", "http://datacite.org/schema/kernel-4"));

return expr.evaluateFirst(element);
}

public List<Element> getXpathElements(Element element, String xpath) {
XPathExpression<Element> expr
= XPathFactory.instance().compile(xpath, Filters.element(), null, MCRConstants.XLINK_NAMESPACE,
Namespace.getNamespace("datacite", "http://datacite.org/schema/kernel-4"));

return expr.evaluate(element);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package de.gbv.metadata.pi;

import java.util.Optional;

import org.mycore.datamodel.metadata.MCRBase;
import org.mycore.datamodel.metadata.MCRObject;
import org.mycore.datamodel.metadata.MetaJSON;
import org.mycore.pi.MCRPIMetadataService;
import org.mycore.pi.MCRPersistentIdentifier;
import org.mycore.pi.doi.MCRDOIParser;
import org.mycore.pi.doi.MCRDigitalObjectIdentifier;
import org.mycore.pi.exceptions.MCRPersistentIdentifierException;

import de.gbv.metadata.MetaJSONHelper;
import de.gbv.metadata.model.Regest;

public class GPOMetadataService extends MCRPIMetadataService<MCRDigitalObjectIdentifier> {

@Override
public void insertIdentifier(MCRDigitalObjectIdentifier doi, MCRBase mcrBase, String additional)
throws MCRPersistentIdentifierException {
if (!(mcrBase instanceof MCRObject mcrObject)) {
throw new MCRPersistentIdentifierException("Only MCRObjects are supported");
}
Regest regest = MetaJSONHelper.getMetaJsonObject(mcrObject, "regest");
regest.setDoi(doi.asString());
MetaJSONHelper.setMetaJsonObject(mcrObject, "regest", regest);
}

@Override
public void removeIdentifier(MCRDigitalObjectIdentifier doi, MCRBase mcrBase, String additional) {
throw new UnsupportedOperationException();
}

@Override
public Optional<MCRPersistentIdentifier> getIdentifier(MCRBase mcrBase, String additional)
throws MCRPersistentIdentifierException {
if (!(mcrBase instanceof MCRObject mcrObject)) {
throw new MCRPersistentIdentifierException("Only MCRObjects are supported");
}
Regest regest = MetaJSONHelper.getMetaJsonObject(mcrObject, "regest");
String doi = regest.getDoi();
MCRDOIParser parser = new MCRDOIParser();
return parser.parse(doi).map(MCRDigitalObjectIdentifier.class::cast);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ MCR.Access.RulesURI=resource:rules.xml
MCR.Access.Class=org.mycore.access.facts.MCRFactsAccessSystem
MCR.Access.Strategy.Class=org.mycore.access.facts.MCRFactsAccessSystem

#----------------------------------------------------------------------
# DOI Config
#----------------------------------------------------------------------
# overwrite default DOI Service, because we need a different URL used in the registration process
MCR.PI.Registration.GPO-Datacite=de.gbv.metadata.pi.GPODOIService
MCR.PI.Registration.GPO-Datacite.MetadataService=GPO-Regest
MCR.PI.Registration.GPO-Datacite.Generator=GPO-DOI
MCR.PI.Registration.GPO-Datacite.RegisterBaseURL=https://qed.perspectivia.net/gallia-pontificia-online/regesten/reims1/regest/
MCR.PI.Registration.GPO-Datacite.Username=
MCR.PI.Registration.GPO-Datacite.Password=
MCR.PI.Registration.GPO-Datacite.UseTestServer=true
MCR.PI.Registration.GPO-Datacite.Transformer=gpo-datacite
MCR.PI.Registration.GPO-Datacite.Prefix=10.58137

MCR.PI.MetadataService.GPO-Regest=de.gbv.metadata.pi.GPOMetadataService

MCR.PI.Generator.GPO-DOI=org.mycore.pi.urn.MCRGenericPIGenerator
MCR.PI.Generator.GPO-DOI.GeneralPattern=10.58137/001-2023-$Count
MCR.PI.Generator.GPO-DOU.CountPrecision=-1

MCR.ContentTransformer.gpo-datacite.Class=de.gbv.metadata.pi.GPODataciteTransformer

#----------------------------------------------------------------------
# MetaJSON Configuration
#----------------------------------------------------------------------
Expand Down
Loading

0 comments on commit cf6dc21

Please sign in to comment.