Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FE
ClassicMayan
METS MODS Mapping
Commits
67e7d6bb
Commit
67e7d6bb
authored
Mar 22, 2022
by
mbrodhu
Browse files
Merge branch 'release/1.1.36'
parents
5c336bdf
0b59b8b8
Changes
17
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
67e7d6bb
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.
MAVEN_OPTS
:
"
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
#MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
MAVEN_CLI_OPTS
:
"
--batch-mode
--errors
--fail-at-end
--show-version"
# 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
:
-
build_version
-
deploy_java
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache
:
key
:
$CI_JOB_NAME
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
# Build and deploy all the JARs to GWDG Nexus, and build all the DEBs and store DEBs to artifacts.
build_and_deploy
:
image
:
maven:3.8.3-jdk-8
only
:
-
develop
-
main
stage
:
deploy_java
script
:
-
'
mvn
$MAVEN_OPTS
$MAVEN_CLI_OPTS
$MAVEN_DEPLOY_OPTS
-U
clean
deploy'
.m2/settings.xml
0 → 100644
View file @
67e7d6bb
<settings
xmlns=
"http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
>
<servers>
<server>
<id>
${env.NEXUS_REPO_ID}
</id>
<username>
${env.NEXUS_REPO_USER}
</username>
<password>
${env.NEXUS_REPO_PW}
</password>
</server>
</servers>
</settings>
.project
View file @
67e7d6bb
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
metsModsMapping
</name>
<comment>
NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.
</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
</buildCommand>
<buildCommand>
<name>
org.eclipse.m2e.core.maven2Builder
</name>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.m2e.core.maven2Nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
</projectDescription>
\ No newline at end of file
<name>
metsModsMapping
</name>
<comment>
NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.
</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.m2e.core.maven2Builder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.m2e.core.maven2Nature
</nature>
<nature>
org.eclipse.jdt.core.javanature
</nature>
</natures>
<filteredResources>
<filter>
<id>
1641986923724
</id>
<name></name>
<type>
30
</type>
<matcher>
<id>
org.eclipse.core.resources.regexFilterMatcher
</id>
<arguments>
node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Jenkinsfile
→
Jenkinsfile
_OLD
View file @
67e7d6bb
File moved
pom.xml
View file @
67e7d6bb
...
...
@@ -5,45 +5,44 @@
<groupId>
org.classicmayan.tools
</groupId>
<artifactId>
metsModsMapping
</artifactId>
<packaging>
jar
</packaging>
<version>
1.1.
25
</version>
<version>
1.1.
36
</version>
<name>
metsModsMapping
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<jdk.version>
1.8
</jdk.version>
<!--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>
<maven-compiler-plugin.version>
3.1
</maven-compiler-plugin.version>
<maven-deploy-plugin.version>
2.8.2
</maven-deploy-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<version>
${junit.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.jena
</groupId>
<artifactId>
jena-arq
</artifactId>
<version>
3.17.0
</version>
<version>
${jena-arq.version}
</version>
</dependency>
<dependency>
<groupId>
org.classicmayan.tools
</groupId>
<artifactId>
idiomQueries
</artifactId>
<version>
1.1.69
</version>
<version>
${idiomQueries.version}
</version>
</dependency>
</dependencies>
<build>
<finalName>
metsModsMapping
</finalName>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.1
</version>
<version>
${maven-compiler-plugin.version}
</version>
<configuration>
<source>
${jdk.version}
</source>
<target>
${jdk.version}
</target>
...
...
@@ -56,7 +55,6 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>
maven-dariah-public
</id>
...
...
@@ -64,7 +62,6 @@
<url>
https://nexus.gwdg.de/repository/maven-dariah-public/
</url>
</repository>
</repositories>
<distributionManagement>
<snapshotRepository>
<id>
maven-dariah-public
</id>
...
...
@@ -77,5 +74,4 @@
<url>
https://nexus.gwdg.de/repository/maven-dariah-public/
</url>
</repository>
</distributionManagement>
</project>
src/main/java/org/classicmayan/tools/ClassicMayanMetsMods.java
View file @
67e7d6bb
...
...
@@ -36,7 +36,7 @@ public class ClassicMayanMetsMods {
private
String
idiomNumber
;
private
String
artefactTitle
;
MetsAmdSec
metsAmdSecAll
=
new
MetsAmdSec
();
MetsDmdSec
metsDmdSec
=
new
MetsDmdSec
();
public
ClassicMayanMetsMods
(
String
textGridURI
,
String
creationDate
,
String
changeDate
)
{
this
.
textGridURI
=
textGridURI
.
replace
(
"http://textgridrep.de/"
,
""
);
...
...
@@ -55,10 +55,27 @@ public class ClassicMayanMetsMods {
this
.
setArtefactGenre
();
this
.
setPhysicalDescription
();
this
.
setRelatedItems
();
this
.
setModsTranscriptionAndTranslation
();
//
this.setModsTranscriptionAndTranslation();
this
.
setAccessCondition
();
/*try {
addImageDmd();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
public
MetsDmdSec
buildDmdSec
(){
MetsDmdSec
metsDmdSec
=
new
MetsDmdSec
();
return
metsDmdSec
;
}
public
MetsStructMap
buildStructMap
(
String
type
){
MetsStructMap
structMap
=
new
MetsStructMap
(
type
);
...
...
@@ -203,7 +220,7 @@ public class ClassicMayanMetsMods {
relatedItems
.
add
(
new
ModsRelatedItem
(
artefactPartURI
,
"constituent"
));
}
for
(
ModsRelatedItem
imageItem
:
getImagesAsRelatedItem
())
{
relatedItems
.
add
(
imageItem
);
relatedItems
.
add
(
imageItem
);
}
mods
.
addModsRelatedItem
(
allRealtedItems
);
}
catch
(
Exception
e
)
{
...
...
@@ -235,6 +252,17 @@ public class ClassicMayanMetsMods {
mods
.
addModsAccessCondition
(
modsAccessCondition
);
}
/*public void addImageDmd() throws JSONException, IOException{
MetsDmdSec imageDmdSec = new MetsDmdSec();
Queries queries = new Queries();
for(String imageURI : queries.getImagesOfArtefact(textGridURI)){
ImageMetsMods imageMetsMods = new ImageMetsMods(new ConedaKorID(imageURI));
this.mets.addMetsDmdSec(imageMetsMods.buildDmdSec());
}
//return imageDmdSec;
}*/
public
List
<
ModsRelatedItem
>
getImagesAsRelatedItem
()
throws
JSONException
,
IOException
{
List
<
ModsRelatedItem
>
modsRelatedItemForImagesList
=
new
ArrayList
<
ModsRelatedItem
>();
...
...
@@ -434,7 +462,7 @@ public class ClassicMayanMetsMods {
metsAmdSec
.
addMetsDigiProvMD
(
metsDigiProvMD
);
mets
.
addMetsStructMap
(
new
MetsStructMap
());
//
mets.addMetsStructMap(new MetsStructMap());
return
mets
.
getMetsXML
();
}
...
...
src/main/java/org/classicmayan/tools/ImageMetsMods.java
View file @
67e7d6bb
package
org.classicmayan.tools
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.text.ParseException
;
import
com.orientechnologies.orient.core.storage.ridbag.sbtree.Change
;
import
org.apache.commons.io.IOUtils
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
info.textgrid.clients.CrudClient
;
import
info.textgrid.clients.tgcrud.CrudClientException
;
import
info.textgrid.clients.tgcrud.TextGridObject
;
public
class
ImageMetsMods
{
private
String
ID
;
...
...
@@ -23,6 +32,31 @@ public class ImageMetsMods {
private
String
licenseNote
;
private
String
creationDateOfImage
;
public
ImageMetsMods
(
TextGridUri
textgridURI
)
throws
CrudClientException
,
IOException
{
TextGridObject
tgObject
=
getJSONObjectFromTextGridRep
(
textgridURI
);
InputStream
inputStream
=
tgObject
.
getData
();
String
mediumMetadataJsonEncoded
=
IOUtils
.
toString
(
inputStream
,
StandardCharsets
.
UTF_8
);
this
.
imageMetadata
=
new
JSONObject
(
mediumMetadataJsonEncoded
);
this
.
setID
(
Integer
.
toString
(
imageMetadata
.
getInt
(
"id"
)));
this
.
setCreationDate
(
tgObject
.
getMetadatada
().
getObject
().
getGeneric
().
getGenerated
().
getCreated
().
toString
());
this
.
setChangeDate
(
tgObject
.
getMetadatada
().
getObject
().
getGeneric
().
getGenerated
().
getLastModified
().
toString
());
this
.
setCreator
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"creator"
));
this
.
setRightsHolder
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"rights_holder"
));
this
.
setMimeType
(
imageMetadata
.
getJSONObject
(
"medium"
).
getString
(
"content_type"
));
this
.
setThumbnailURL
(
imageMetadata
.
getJSONObject
(
"medium"
).
getJSONObject
(
"url"
).
getString
(
"thumbnail"
));
this
.
setDefaultURL
(
imageMetadata
.
getJSONObject
(
"medium"
).
getJSONObject
(
"url"
).
getString
(
"original"
));
this
.
setTitle
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"image_description"
));
this
.
setLicense
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"license"
));
if
(
getLicense
().
equals
(
"RESERVED"
)){
this
.
setLicenseNote
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"license_note"
));
}
this
.
setCreationDateOfImage
(
imageMetadata
.
getJSONObject
(
"dataset"
).
getString
(
"date_time_created"
));
buildMets
();
}
public
ImageMetsMods
(
JSONObject
imageMetadata
){
this
.
imageMetadata
=
imageMetadata
;
this
.
setID
(
Integer
.
toString
(
imageMetadata
.
getInt
(
"id"
)));
...
...
@@ -42,6 +76,25 @@ public class ImageMetsMods {
buildMets
();
}
public
String
testitest
(){
return
""
;
}
public
TextGridObject
getJSONObjectFromTextGridRep
(
TextGridUri
textGridURI
)
throws
CrudClientException
,
IOException
{
CrudClient
crudclient
=
null
;
try
{
crudclient
=
new
CrudClient
(
CrudClient
.
DEFAULT_ENDPOINT
)
.
enableGzipCompression
();
}
catch
(
CrudClientException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
TextGridObject
tgobj
=
crudclient
.
read
().
setSid
(
"tMLRawENEHZiIewzqySoZAgACydsnPKp43rcuirY3VMwld3r84pce7VIFFgAthJhLGtxTrMgaJrhES1645039383955573"
)
.
setTextgridUri
(
textGridURI
.
getValue
()).
execute
();
return
tgobj
;
}
public
String
getCreationDateOfImage
()
{
return
creationDateOfImage
;
}
...
...
src/main/java/org/classicmayan/tools/Mets.java
View file @
67e7d6bb
...
...
@@ -30,8 +30,8 @@ public class Mets {
List
<
MetsDmdSec
>
dmdSecs
=
new
ArrayList
<
MetsDmdSec
>();
List
<
MetsAmdSec
>
amdSecs
=
new
ArrayList
<
MetsAmdSec
>();
List
<
MetsFileSec
>
fileSecs
=
new
ArrayList
<
MetsFileSec
>();
List
<
MetsStructLink
>
structLinks
=
new
ArrayList
<
MetsStructLink
>();
List
<
MetsStructLink
>
structLinks
=
new
ArrayList
<
MetsStructLink
>();
public
MetsHdr
addMetsHeader
(
MetsHdr
metsHdr
)
{
this
.
metsHdr
=
metsHdr
;
return
metsHdr
;
...
...
src/main/java/org/classicmayan/tools/MetsDmdSec.java
View file @
67e7d6bb
package
org.classicmayan.tools
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
*
...
...
@@ -14,6 +16,7 @@ public class MetsDmdSec {
private
String
id
;
public
MetsMdWrap
metsMdWrap
;
public
MetsDmdSec
(){
/**
* Default Counstructor
...
...
src/main/java/org/classicmayan/tools/Mods.java
View file @
67e7d6bb
...
...
@@ -117,6 +117,12 @@ public class Mods {
for
(
ModsGenre
modsGenre
:
modsGenres
){
genres
+=
modsGenre
.
getXML
();
}
try
{
modsStartTag
.
concat
(
modsNote
.
buildAllModsNotes
());
}
catch
(
NullPointerException
e
){
}
return
modsStartTag
+
modsRecordInfo
.
getRecordInfoXML
()
+
modsTitleInfo
.
getModsTitleInfoXML
()
+
...
...
@@ -127,7 +133,7 @@ public class Mods {
//modsGenre.getModsGenreXML() +
modsPhysicalDescription
.
getModsPhysicalDescriptionXML
()
+
relatedItem
+
modsNote
.
buildAllModsNotes
()
+
//
modsNote.buildAllModsNotes() +
modsAccessCondition
.
getXML
()
+
modsCloseTag
;
}
...
...
src/main/java/org/classicmayan/tools/ModsCopyRight.java
View file @
67e7d6bb
...
...
@@ -30,7 +30,7 @@ public class ModsCopyRight {
public
ModsGeneralNote
modsGeneralNote
;
private
List
<
ModsGeneralNote
>
modsGeneralNotesList
=
new
ArrayList
<
ModsGeneralNote
>();
private
String
xmlCode
;
private
final
String
xmlns
=
"xmlns=\"http
s
://www.cdlib.org/inside/diglib/copyrightMD\""
;
private
final
String
xmlns
=
"xmlns=\"http://www.cdlib.org/inside/diglib/copyrightMD\""
;
private
final
String
xsiSchemaLocation
=
"xsi:schemaLocation=\"http://www.cdlib.org/inside/diglib/copyrightMD http://www.cdlib.org/groups/rmg/docs/copyrightMD.xsd\""
;
public
ModsCopyRight
()
{}
...
...
src/main/java/org/classicmayan/tools/ModsDateCreated.java
View file @
67e7d6bb
...
...
@@ -81,7 +81,8 @@ public class ModsDateCreated {
return
"<dateCreated keyDate=\""
+
getKeyDate
()
+
"\" encoding=\"iso8601\">"
+
getDateCreatedValue
().
substring
(
0
,
getDateCreatedValue
().
indexOf
(
"-"
)
)
+
"</dateCreated>"
;
}
else
{
}
else
{
return
"<dateCreated keyDate=\""
+
getKeyDate
()
+
"\" encoding=\"iso8601\">"
+
encodeDateInISO8601
(
getDateCreatedValue
())
+
"</dateCreated>"
;
...
...
@@ -178,7 +179,7 @@ public class ModsDateCreated {
isoEncodedDate
=
getDateCreatedValue
().
substring
(
0
,
getDateCreatedValue
().
indexOf
(
"-"
));
if
(
Integer
.
parseInt
(
isoEncodedDate
)<
1000
)
{
isoEncodedDate
=
"0"
+
isoEncodedDate
;
//
isoEncodedDate = "0" + isoEncodedDate;
if
(
Integer
.
parseInt
(
isoEncodedDate
)<
0
)
{
isoEncodedDate
=
"-"
+
isoEncodedDate
;
}
...
...
@@ -196,7 +197,12 @@ public class ModsDateCreated {
}
public
String
getXML
(){
return
"<dateCreated encoding=\""
+
encoding
.
getValue
()
+
"\">"
+
getDateCreatedValue
()
+
"</dateCreated>"
;
if
(!
getDateCreatedValue
().
getClass
().
getName
().
equals
(
"java.lang.String"
)){
return
"<dateCreated encoding=\""
+
encoding
.
getValue
()
+
"\">"
+
getDateCreatedValue
()
+
"</dateCreated>"
;
}
else
{
return
"<dateCreated>"
+
getDateCreatedValue
()
+
"</dateCreated>"
;
}
}
}
src/main/java/org/classicmayan/tools/ModsNote.java
View file @
67e7d6bb
...
...
@@ -50,10 +50,13 @@ public class ModsNote {
public
String
buildAllModsNotes
()
{
String
notes
=
""
;
for
(
ModsNote
note
:
this
.
notes
){
notes
=
notes
.
concat
(
note
.
getModsNoteXML
());
System
.
out
.
println
(
this
.
notes
.
size
());
if
(
this
.
notes
.
size
()
>
0
){
for
(
ModsNote
note
:
this
.
notes
){
notes
=
notes
.
concat
(
note
.
getModsNoteXML
());
}
}
return
notes
;
}
...
...
src/main/java/org/classicmayan/tools/Queries.java
View file @
67e7d6bb
...
...
@@ -93,6 +93,29 @@ public class Queries {
}
public
List
<
String
>
getImagesOfArtefact
(
String
tgArtefactURI
){
String
query
=
AllSparqlPrefixes
+
"SELECT distinct ?tgObject ?textgridUriForArtefact ?conedakorLink WHERE { "
+
"GRAPH <"
+
tgArtefactURI
+
"> {"
+
"?tgObject rdf:type idiom:Artefact."
+
"?tgObject idiom:shows ?conedakorLink."
+
"}"
+
"} "
;
QueryExecution
q
=
QueryExecutionFactory
.
sparqlService
(
queryURL
,
query
);
ResultSet
results
=
q
.
execSelect
();
List
<
String
>
imageList
=
new
ArrayList
<
String
>();
while
(
results
.
hasNext
())
{
QuerySolution
soln
=
results
.
nextSolution
();
RDFNode
conedaKorImageIdentifier
=
soln
.
get
(
"conedakorLink"
);
imageList
.
add
(
conedaKorImageIdentifier
.
toString
());
}
return
imageList
;
}
public
List
<
String
>
getArtefactListWithImages
()
{
String
query
=
...
...
@@ -316,7 +339,7 @@ public class Queries {
QueryExecution
q
=
QueryExecutionFactory
.
sparqlService
(
queryURL
,
query
);
ResultSet
results
=
q
.
execSelect
();
ResultSet
test
=
q
.
execSelect
();
List
<
String
>
placeTypes
=
new
ArrayList
<
String
>();
QuerySolution
solnNext
=
null
;
...
...
@@ -326,14 +349,16 @@ public class Queries {
placeTypes
.
add
(
soln
.
get
(
"placeType"
).
toString
());
}
solnNext
=
soln
;
//System.out.println(soln.get("placeName").toString());
}
if
(
solnNext
!=
null
&&
solnNext
.
get
(
"placeType"
)!=
null
&&
(
placeTypes
.
contains
(
"http://idiom-projekt.de/voc/placetype/concept000010"
)
||
placeTypes
.
contains
(
"http://idiom-projekt.de/voc/placetype/concept000011"
)))
{
return
solnNext
.
get
(
"placeName"
).
toString
();
}
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
null
;
return
"WOOP"
;
}
}
...
...
@@ -525,20 +550,25 @@ public class Queries {
public
static
String
getVocabulary
(
String
conceptUri
)
{
String
queryInVocabulary
=
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
+
"PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\n"
+
"PREFIX dct: <http://purl.org/dc/terms/>\n"
+
"\n"
+
"SELECT DISTINCT ?before ?conceptName ?conceptUri\n"
+
" WHERE { \n"
+
" <"
+
conceptUri
+
"> skos:prefLabel ?conceptName.\n"
+
" FILTER(LANG(?conceptName) = \"\" || LANGMATCHES(LANG(?conceptName), \"en\")) \n"
+
"}"
;
//try{
String
queryInVocabulary
=
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
+
"PREFIX skos: <http://www.w3.org/2004/02/skos/core#>\n"
+
"PREFIX dct: <http://purl.org/dc/terms/>\n"
+
"\n"
+
"SELECT DISTINCT ?before ?conceptName ?conceptUri\n"
+
" WHERE { \n"
+
" <"
+
conceptUri
+
"> skos:prefLabel ?conceptName.\n"
+
" FILTER(LANG(?conceptName) = \"\" || LANGMATCHES(LANG(?conceptName), \"en\")) \n"
+
"}"
;
QueryExecution
qVoc
=
QueryExecutionFactory
.
sparqlService
(
vocabularyURL
,
queryInVocabulary
);
ResultSet
resultsVoc
=
qVoc
.
execSelect
();
QuerySolution
solnVoc
=
resultsVoc
.
next
();
return
solnVoc
.
get
(
"conceptName"
).
toString
().
replace
(
"@en"
,
""
);
QueryExecution
qVoc
=
QueryExecutionFactory
.
sparqlService
(
vocabularyURL
,
queryInVocabulary
);
ResultSet
resultsVoc
=
qVoc
.
execSelect
();
QuerySolution
solnVoc
=
resultsVoc
.
next
();
return
solnVoc
.
get
(
"conceptName"
).
toString
().
replace
(
"@en"
,
""
);
/* }catch(NoSuchElementException element){
System.out.println("No Element in vocabulary found: " + conceptUri);
}
return "";*/
}
}
src/main/java/org/classicmayan/tools/TextGridUri.java
0 → 100644
View file @
67e7d6bb
package
org.classicmayan.tools
;
public
class
TextGridUri
{
private
String
value
;
public
TextGridUri
(
String
value
){
this
.
value
=
value
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/test/java/org/classicmayan/tools/MetsTest.java
View file @
67e7d6bb
...
...
@@ -275,7 +275,7 @@ 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:3
cxrn
"
,
"2016-02-18T11:15:19.899+01:00"
,
"2018-02-02T12:12:34.113+01:00"
).
getMets
());
System
.
out
.
println
(
new
ClassicMayanMetsMods
(
"textgrid:3
pnw1
"
,
"2016-02-18T11:15:19.899+01:00"
,
"2018-02-02T12:12:34.113+01:00"
).
getMets
());
}
...
...
@@ -287,7 +287,7 @@ public class MetsTest {
@Test
public
void
testImageAsRelatedItem
()
throws
JSONException
,
IOException
,
ParseException
{
ClassicMayanMetsMods
cmmm
=
new
ClassicMayanMetsMods
(
"textgrid:3
bxs0
"
,
"2016-02-18T11:15:19.899+01:00"
,
"2018-02-02T12:12:34.113+01:00"
);
ClassicMayanMetsMods
cmmm
=
new
ClassicMayanMetsMods
(
"textgrid:3
qh1z
"
,
"2016-02-18T11:15:19.899+01:00"
,
"2018-02-02T12:12:34.113+01:00"
);
System
.
out
.
println
(
cmmm
.
getMets
());
}
...
...
@@ -359,6 +359,33 @@ public class MetsTest {
System
.
out
.
println
(
"------------------------------------------\n"
);