Commit fd8f97dd authored by mbrodhu's avatar mbrodhu
Browse files

Merge branch 'release/1.1.39'

parents d7becc4f 23ad57c6
###
# PREPARATIONS
###
# Some variables
# TODO: Apply also as a template!
variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
......@@ -9,30 +15,9 @@ variables:
# Nexus Deployment settings, please use env vars in Settings -> CI/CD -> Variables.
MAVEN_SETTINGS_PATH: ".m2/settings.xml"
MAVEN_DEPLOY_OPTS: "--settings=$MAVEN_SETTINGS_PATH"
# File for storing the POM project.version
VARIABLES_FILE: ./variables.txt
###################
### TEMPLATES ###
###################
.webapp: &webapp
image: alpine:3.14
stage: deploy_deb
script:
- source $VARIABLES_FILE
- 'apk add --no-cache bash'
- 'apk add --no-cache curl'
- export PLOC="$(ls ./${PPATH}/*.deb)"
- DEB_NAME=$PNAME-$PVERSION.deb
- 'if [[ $PVERSION =~ .*${PKEY}$ ]]; then'
- echo "---A ${PKEY} BUILD IS BEING PERFORMED---"
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X POST --header "Content-Type:multipart/form-data" -F file=@${PLOC} ${APTLY_URL}/files/${DEB_NAME}'
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X POST ${APTLY_URL}/repos/${APTLY_TARGET}/file/${DEB_NAME}'
- 'curl -u ${APTLY_USER}:${APTLY_PASSWORD} -X PUT -H "Content-Type: application/json" --data "{}" ${APTLY_URL}/publish/:./indy'
- fi
# Stages...
stages:
- build_version
- deploy_java
# Cache downloaded dependencies and plugins between builds.
......@@ -42,24 +27,12 @@ cache:
paths:
- .m2/repository
# Get the project version from main POM file and store it to artifact.
get_version:
image: maven:3.8.3-jdk-8
only:
- develop
- main
stage: build_version
script:
- 'PVERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.1:evaluate -Dexpression=project.version -q -DforceStdout)'
- echo "export PVERSION=$PVERSION" > $VARIABLES_FILE
- echo "Project version from main pom file is $PVERSION"
artifacts:
name: POM_VERSION
paths:
- $VARIABLES_FILE
###
# JOBS
###
# Build and deploy all the JARs to GWDG Nexus, and build all the DEBs and store DEBs to artifacts.
build_and_deploy:
Build and deploy JAR:
image: maven:3.8.3-jdk-8
only:
- develop
......
This diff is collapsed.
# METS MODS Mapping
An implementation of the mapping created by the project "Textdatabase and Dictionary of Classic Mayan".
In the first setp it takes an URI of an Artefact-RDF-File (meaning the rdf-class "Artefact" of the IDIOM-Schema (https://www.classicmayan.org/rdfmask/idiom.ttl)). Based on this it queries several related fles of activities, vocabularies, images and so on.
The result is a representation of an Artefact with all related and important metadata from the schema.
This mapping must be included in the pom file of the oai-pmh code of the TextGrid-OAI-PMH interface (https://gitlab.gwdg.de/dariah-de/dariah-de-oai-pmh-services). In other way the it won't be possible to harvesting the data from TextGrid.
Additionally it process also a files in METS/MODS representation based on an identifier of an image in the ConedaKor-Database of the project (https://classicmayan.kor.de.dariah.eu/).
......@@ -5,7 +5,7 @@
<groupId>org.classicmayan.tools</groupId>
<artifactId>metsModsMapping</artifactId>
<packaging>jar</packaging>
<version>1.1.37</version>
<version>1.1.39</version>
<name>metsModsMapping</name>
<url>http://maven.apache.org</url>
<properties>
......@@ -14,7 +14,7 @@
<!--cxf.version>3.2.3</cxf.version> <spring.version>4.0.2.RELEASE</spring.version -->
<junit.version>4.12</junit.version>
<jena-arq.version>3.17.0</jena-arq.version>
<idiomQueries.version>1.1.69</idiomQueries.version>
<idiomQueries.version>1.2.5-SNAPSHOT</idiomQueries.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
</properties>
......
......@@ -197,13 +197,40 @@ public class ClassicMayanMetsMods {
forms.add(new Form(fdo.getLang(), fdo.getType(), fdo.getValueURI(), fdo.getFormValue()));
}
for(ExtentDataObject edo : physicalDescriptionDataObject.extentListDimensions) {
String height = "";
String width ="";
String thickness = "";
if(edo.getHeight().length()>0){
height = edo.getHeight() + " " + edo.getUnit() + " (height)";
}else{
height = "";
}
if(edo.getWidth().length()>0){
System.out.println("HEIGH: " + edo.getWidth());
width = edo.getWidth() + " " + edo.getUnit() + " (width)";
}else{
width = "";
}
if(edo.getThickness().length()>0){
thickness = edo.getThickness() + " " + edo.getUnit() + " (thickness)";
}else{
thickness = "";
}
extents.add(new Extent(
edo.getHeight() + " " + edo.getUnit() + " (height), " +
edo.getWidth() + " " + edo.getUnit() + " (width), " +
edo.getThickness() + " " + edo.getUnit() + " (thickness)"));
height +
width +
thickness));
}
modsPhysicalDescription.addForm(allForms);
modsPhysicalDescription.addExtent(allExtents);
mods.addModsPhysicalDescription(modsPhysicalDescription);
}
......@@ -271,92 +298,35 @@ public class ClassicMayanMetsMods {
//List<ModsDateCreated> creationDates = new ArrayList<ModsDateCreated>();
//ModsDateCreated allCreationDates = new ModsDateCreated(creationDates);
//System.out.println(linkedMedium);
//System.out.println(ConedaKorQueries.getMediumMetadaSetForMetsMods(linkedMedium));
JSONObject imageDataFromConedaKor = new JSONObject();
try{
imageDataFromConedaKor = ConedaKorQueries.getMediumMetadaSetForMetsMods(linkedMedium);
ModsRelatedItem imageRelatedItem = new ModsRelatedItem();
//Set the metadata for RecordIdentifier
imageRelatedItem.setType("constituent");
imageRelatedItem.setRefToComposedObject(imageDataFromConedaKor.get("<recordIdentifier(returnedEntity)>").toString());
modsRelatedItemForImagesList.add(imageRelatedItem);
}catch(JSONException mediaNotFound){
//imageDataFromConedaKor = ConedaKorQueries.readJsonObjectFromUrl("https://classicmayan.kor.de.dariah.eu/entities/"+ linkedMedium + ".json?include=dataset,technical");
ModsRelatedItem imageRelatedItem = new ModsRelatedItem();
//Set the metadata for RecordIdentifier
imageRelatedItem.setType("constituent");
imageRelatedItem.setRefToComposedObject(linkedMedium);
modsRelatedItemForImagesList.add(imageRelatedItem);
}
System.out.println(imageDataFromConedaKor);
JSONObject imageDataFromConedaKor = ConedaKorQueries.getMediumMetadaSetForMetsMods(linkedMedium);
ModsRelatedItem imageRelatedItem = new ModsRelatedItem();
/*ModsRelatedItem imageRelatedItem = new ModsRelatedItem();
//Set the metadata for RecordIdentifier
imageRelatedItem.setType("constituent");
imageRelatedItem.setRefToComposedObject(imageDataFromConedaKor.get("<recordIdentifier(returnedEntity)>").toString());
/*if(imageDataFromConedaKor.getString("<dateCrated>").length() > 0){
ModsOriginInfo modsOriginInfo = new ModsOriginInfo();
ModsDateCreated modsDateCreated = new ModsDateCreated();
modsDateCreated.setKeyDate("yes");
modsDateCreated.setDateCreatedValue(imageDataFromConedaKor.getString("<dateCrated>")+ "-11-19");
creationDates.add(modsDateCreated);
imageRelatedItem.addOriginInfo(modsOriginInfo);
}*/
//Add TitleInfo to RelatedImage
/*ModsTitleInfo modsTitleInfo = new ModsTitleInfo();
modsTitleInfo.setModsTitleInfoLanguageValue("en");
modsTitleInfo.setModsTitleInfoValue(imageDataFromConedaKor.getString("<title>"));
imageRelatedItem.addModsTitleInfo(modsTitleInfo);*/
//Add RightsHolder (AccessCondition)
/*ModsAccessCondition modsAccessCondition = new ModsAccessCondition();
try {
String license_note = ConedaKorQueries.getMediumMetadaSetForMetsMods(linkedMedium).getString("license_note");
ModsCopyRight modsCopyRight = new ModsCopyRight("copyrighted");
ModsGeneralNote modsGeneralNote = new ModsGeneralNote(license_note);
modsCopyRight.addModsGeneralNote(modsGeneralNote);
modsAccessCondition.addModsCopyRight(modsCopyRight);
}catch(JSONException notFound) {
modsAccessCondition = new ModsAccessCondition("use and reproduction", "kor_license");
modsAccessCondition.setAccessConditionValue(imageDataFromConedaKor.getString("<imageLicense>"));
}*/
/*ModsAccessCondition reservedCopyrights = new ModsAccessCondition();
ModsCopyRight copyRightsForReserverdAccessCondition = new ModsCopyRight(
new CopyrightStats("copyrighted"),
new PublicationStatus("unpublished"));
reservedCopyrights.addModsCopyRight(copyRightsForReserverdAccessCondition);
mods.addModsAccessCondition(reservedCopyrights);*/
//Add CopryrightHolder
/*ModsName modsName = new ModsName();
ModsNamePart modsNamePart = new ModsNamePart();
modsNamePart.setNamePartValue(imageDataFromConedaKor.getString("<copryrightHolder>"));*/
//Add ModsRole
/*ModsRole modsRole = new ModsRole();
ModsRoleTerm modsRoleTerm = new ModsRoleTerm();
modsRoleTerm.setAuthority("marcrelator");
modsRoleTerm.setType("code");
modsRoleTerm.setRoleTermValue("cph");
modsRole.addModsRoleTerm(modsRoleTerm);
modsName.addModsNamePart(modsNamePart);
modsName.addModsRole(modsRole);
List<ModsName> modsNameList = new ArrayList<ModsName>();*/
//Add Image Creator
/*ModsName modsNameForImageCreator = new ModsName(modsNameList);
ModsNamePart modsNamePartImageCreator = new ModsNamePart();
modsNamePartImageCreator.setNamePartValue(imageDataFromConedaKor.getString("<imageCreator>"));*/
//Add ModsRole for Image Creator
/*ModsRole modsRoleImageCreator = new ModsRole();
ModsRoleTerm modsRoleTermImageCreator = new ModsRoleTerm();
modsRoleTermImageCreator.setAuthority("marcrelator");
modsRoleTermImageCreator.setType("code");
modsRoleTermImageCreator.setRoleTermValue("cre");
modsRoleImageCreator.addModsRoleTerm(modsRoleTermImageCreator);
modsNameForImageCreator.addModsNamePart(modsNamePartImageCreator);
modsNameForImageCreator.addModsRole(modsRoleImageCreator);
modsNameList.add(modsName);
modsNameList.add(modsNameForImageCreator);*/
//modsOriginInfo.addDateCreated(allCreationDates);
//imageRelatedItem.addModsAccessCondition(modsAccessCondition);
//imageRelatedItem.addModsName(modsName);
//imageRelatedItem.addModsName(modsNameForImageCreator);
modsRelatedItemForImagesList.add(imageRelatedItem);
modsRelatedItemForImagesList.add(imageRelatedItem);*/
}
return modsRelatedItemForImagesList;
......
......@@ -122,7 +122,11 @@ public class Mods {
}catch(NullPointerException e){
}
String physicalDescription = "";
if(!modsPhysicalDescription.getModsPhysicalDescriptionXML().equals("<physicalDescription></physicalDescription>")){
physicalDescription = modsPhysicalDescription.getModsPhysicalDescriptionXML();
System.out.println(physicalDescription);
}
return modsStartTag +
modsRecordInfo.getRecordInfoXML() +
modsTitleInfo.getModsTitleInfoXML() +
......@@ -131,7 +135,7 @@ public class Mods {
modsOriginInfo.getModsOriginInfoXML() +
genres +
//modsGenre.getModsGenreXML() +
modsPhysicalDescription.getModsPhysicalDescriptionXML() +
physicalDescription +
relatedItem +
//modsNote.buildAllModsNotes() +
modsAccessCondition.getXML() +
......
......@@ -253,6 +253,7 @@ public class Queries {
"?custodyPlaceRef crm:P87_is_identified_by ?custodyPlaceNameRef. " +
"BIND(IRI(CONCAT(' + \"<\" + ',?custodyPlaceNameRef,' + \">\" + ')) AS ?custodyPlaceNameRefUri) " +
"GRAPH ?custodyPlaceNameRefUri{" +
" ?custodyPlaceNameRef idiom:placeNameType \"preferred\".\n" +
"?custodyPlaceNameRef idiom:placeName ?custodyPlaceName." +
"}" +
"}" +
......@@ -267,7 +268,7 @@ public class Queries {
" ?discoveryPlaceRef crm:P87_is_identified_by ?placeNameRef.\n" +
" BIND(IRI(CONCAT(' + \"<\" + ',?placeNameRef,' + \">\" + ')) AS ?placeNameRefUri)\n" +
" GRAPH ?placeNameRefUri {\n" +
" ?placeNameRef idiom:placeNameType \"preferred\".\n" +
" ?placeNameRef idiom:placeNameType \"preferred\".\n" +
" ?placeNameRef idiom:placeName ?placeName.\n" +
" OPTIONAL {\n" +
" ?discoveryPlaceRef idiom:hasArchaeologicalCoordinates ?archaeologicalCoordinatesRef. \n" +
......@@ -322,6 +323,7 @@ public class Queries {
}
public static String hierarichalPlaceQuery(String textgridURI) {
System.out.println("TEST");
String query = AllSparqlPrefixes + " SELECT DISTINCT ?placeType ?placeName ?nextPlace ?placeTypeToPrint WHERE { GRAPH <" + textgridURI.replace("http://textgridrep.de/", "textgrid:") +"> { \n" +
" ?discoveryPlaceRef rdf:type crm:E53_Place.\n" +
" OPTIONAL {\n" +
......@@ -358,7 +360,7 @@ public class Queries {
}else if (solnNext!= null && !solnNext.get("nextPlace").toString().replace("http://textgridrep.de/", "textgrid:").equals(textgridURI.replace("http://textgridrep.de/", "textgrid:"))){
return hierarichalPlaceQuery(solnNext.get("nextPlace").toString());
}else {
return "WOOP";
return null;
}
}
......@@ -504,10 +506,10 @@ public class Queries {
" ?tgObject crm:P43_has_dimension ?dimensionRef.\n" +
" BIND(IRI(CONCAT(' + \"<\" + ',?dimensionRef,' + \">\" + ')) AS ?dimensionUri)\n" +
" GRAPH ?dimensionUri{\n" +
" ?dimensionRef idiom:height ?height. \n" +
" ?dimensionRef idiom:width ?width.\n" +
" ?dimensionRef idiom:thickness ?thickness.\n" +
" ?dimensionRef idiom:hasUnit ?unit.\n" +
" OPTIONAL {?dimensionRef idiom:height ?height.} \n" +
" OPTIONAL {?dimensionRef idiom:width ?width.}\n" +
" OPTIONAL {?dimensionRef idiom:thickness ?thickness.}\n" +
" OPTIONAL {?dimensionRef idiom:hasUnit ?unit.}\n" +
" }\n" +
" }\n" +
"}";
......@@ -517,11 +519,34 @@ public class Queries {
while(resultsDimensions.hasNext()) {
QuerySolution solnDimensions = resultsDimensions.nextSolution();
String height = "";
String width ="";
String thickness = "";
if(solnDimensions.get("height")!=null){
height = solnDimensions.get("height").toString();
}else{
height = "";
}
if(solnDimensions.get("width")!=null){
width = solnDimensions.get("width").toString();
}else{
width = "";
}
if(solnDimensions.get("thickness")!=null){
thickness = solnDimensions.get("thickness").toString();
}else{
thickness = "";
}
physicalDescriptionDataObject.extentListDimensions.
add(new ExtentDataObject(
solnDimensions.get("height").toString(),
solnDimensions.get("width").toString(),
solnDimensions.get("thickness").toString(),
height,
width,
thickness,
solnDimensions.get("unit").toString()));
}
return physicalDescriptionDataObject;
......
......@@ -275,13 +275,13 @@ public class MetsTest {
@Test
public void testCompleteMetsMods() throws JSONException, ParseException, IOException {
//System.out.println(new ClassicMayanMetsMods("textgrid:3whkp", "2016-02-18T11:15:19.899+01:00", "2018-02-02T12:12:34.113+01:00").getMets());
System.out.println(new ClassicMayanMetsMods("textgrid:3pnw1", "2016-02-18T11:15:19.899+01:00", "2018-02-02T12:12:34.113+01:00").getMets());
System.out.println(new ClassicMayanMetsMods("textgrid:254w6", "2016-02-18T11:15:19.899+01:00", "2018-02-02T12:12:34.113+01:00").getMets());
}
@Test
public void testAddAmdSecForImages() throws JSONException, IOException, ParseException {
ClassicMayanMetsMods cmmm = new ClassicMayanMetsMods("textgrid:3cxrn", "2016-02-18T11:15:19.899+01:00", "2018-02-02T12:12:34.113+01:00");
ClassicMayanMetsMods cmmm = new ClassicMayanMetsMods("textgrid:3vvn7", "2016-02-18T11:15:19.899+01:00", "2018-02-02T12:12:34.113+01:00");
System.out.println(cmmm.getMets());
}
......@@ -366,7 +366,7 @@ public class MetsTest {
@Test
@Ignore
//@Ignore
public void testAllLocations(){
List<String> artefactList = new ArrayList<String>();
Queries queries = new Queries();
......@@ -376,12 +376,14 @@ public class MetsTest {
List<String> nullPlaces = new ArrayList<String>();
for(String artefact : artefactList){
System.out.println(i + " of " + artefactList.size());
if(Queries.getLocationData(artefact).getDiscoveryPlace().equals("unknown")){
unknown = unknown.concat("," + artefact);
if(Queries.getLocationData(artefact).getDiscoveryPlace()== null){
nullPlaces.add(artefact + ";" + Queries.getArtefactTitle(artefact));
}
i++;
}
System.out.println(unknown);
for(String artfact : nullPlaces){
System.out.println(artfact);
}
}
// @Test
......
......@@ -49,7 +49,7 @@ public class testImageMets{
@Test
public void getMETSMODSByTgURI() throws JSONException, IOException, CrudClientException, ParseException{
ImageMetsMods tgURITest = new ImageMetsMods(new TextGridUri("textgrid:3xm10.0"));
ImageMetsMods tgURITest = new ImageMetsMods(new TextGridUri("textgrid:3x8ks.0"));
System.out.println(tgURITest.getXML());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment