# HG changeset patch
# User casties
# Date 1481209518 -3600
# Node ID e5d4443a1bc518f0decaacb68ce1050b0dd6d52c
# Parent 9adcab5143a3486f05e6a98df0b54b83bdd70513
cleanuop: remove unused DM2E, ECHOViewer and Geonames classes.
diff -r 9adcab5143a3 -r e5d4443a1bc5 pom.xml
--- a/pom.xml Tue Nov 15 12:36:06 2016 +0100
+++ b/pom.xml Thu Dec 08 16:05:18 2016 +0100
@@ -245,26 +245,6 @@
-
- org.openrdf.sesame
- sesame-rio-api
- 2.7.6
-
-
- org.openrdf.sesame
- sesame-rio-rdfxml
- 2.7.6
-
-
- org.openrdf.sesame
- sesame-rio-ntriples
- 2.7.6
-
-
- org.openrdf.sesame
- sesame-rio-rdfjson
- 2.7.6
-
-
- org.openrdf.sesame
- sesame-repository-api
- 2.8.1
-
-
- org.openrdf.sesame
- sesame-sail-api
- 2.8.1
-
-
- org.openrdf.sesame
- sesame-repository-sail
- 2.8.1
-
-
- org.openrdf.sesame
- sesame-sail-memory
- 2.8.1
-
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/Borrar.java
--- a/src/main/java/Borrar.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-public class Borrar {
-
- public static void main(String[] args) {
- String s = new String("CODEX:distinguishing_features&CODEX¬es_on_ownership&CODEX:notes");
- String[] array = s.split("&");
- System.out.println(array.length);
- }
-
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/AddAgents.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/AddAgents.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import java.util.List;
-
-import org.mpi.openmind.cache.WrapperService;
-import org.mpi.openmind.repository.bo.Entity;
-import org.openrdf.model.Model;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-
-import de.mpiwg.itgroup.ismi.utils.templates.WitnessTemplate;
-
-public class AddAgents {
-
-
- public static void execute(Model g, ValueFactory f, URI providedCHO, WitnessTemplate witness, WrapperService wrapper) throws Exception {
-
- List list = wrapper.getTargetsForSourceRelation(witness.titleId, "was_created_by", "PERSON", 1);
- if(list.size() > 0){
- Entity author = list.get(0);
-
- URI uriPerson = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/" + author.getId());
-
- g.add(f.createStatement(uriPerson, URIUtils.skosPrefLabel, f.createLiteral(author.getOwnValue())));
- g.add(f.createStatement(uriPerson, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Person")));
- g.add(f.createStatement(providedCHO, URIUtils.proAuthor, uriPerson));
-
- }
-
-
- //COPY_EVENT
- list = wrapper.getSourcesForTargetRelation(witness.id, "is_a_copy_of", "COPY_EVENT", -1);
- for(Entity copyEvent : list){
- List list0 = wrapper.getTargetsForSourceRelation(copyEvent.getId(), "has_person_copying_text", "PERSON", 1);
- if(list0.size() > 0){
-
- Entity personCopyingText = list0.get(0);
-
- URI uriPerson = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/" + personCopyingText.getId());
-
- g.add(f.createStatement(uriPerson, URIUtils.skosPrefLabel, f.createLiteral(personCopyingText.getOwnValue())));
- g.add(f.createStatement(uriPerson, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Person")));
- g.add(f.createStatement(providedCHO, URIUtils.dm2eCopyist, uriPerson));
- }
- }
-
-
-
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/DM2E.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/DM2E.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-
-/**
- * http://onto.dm2e.eu/schemas/dm2e/1.0/
- *
- * @author jurzua
- *
- */
-public class DM2E {
-
- static ValueFactory f;
-
- //edm:PhysicalThing
- static public URI dm2eOnto10;
- static public URI Archive; //Superclass: foaf:Organization
- static public URI Collection; //Superclass: edm:NonInformationResource
- static public URI Document; //Subclass: dm2e:Manuscript
- static public URI File; //Superclasses: edm:PhysicalThing
- static public URI Manuscript; //Superclass: dm2e:Document
- static public URI Paragraph; //Superclass: skos:Concept
- static public URI Photo; //Superclasses: edm:PhysicalThing, foaf:Image
- static public URI Publication; //Superclass: skos:Concept
- static public URI Work; //Superclass: skos:Concept
-
- static public URI Page;
- static public URI Book;
-
-
- //Properties
- static public URI artist;
- static public URI callNumber;
- static public URI composer;
- static public URI condition;
- static public URI contributor;
- static public URI copyist;
- static public URI explicit;
- static public URI hasPartCHO;
- static public URI hasPartPlace;
- static public URI hasPartTimeSpan;
- static public URI hasPartWebResource;
- static public URI honoree;
- static public URI illustration;
- static public URI incipit;
- static public URI influencedBy;
- static public URI isDerivativeOfCHO;
- static public URI isDerivativeOfWebResource;
- static public URI isPartOfCHO;
- static public URI isPartOfPlace;
- static public URI isPartOfTimeSpan;
- static public URI isPartOfWebResource;
- static public URI levelOfGenesis;
- static public URI mentioned;
- static public URI misattributed;
- static public URI owner;
- static public URI pageDimension;
- static public URI painter;
- static public URI patron;
- static public URI portrayed;
- static public URI previousOwner;
- static public URI principal;
- static public URI printedAt;
- static public URI publishedAt;
- static public URI refersTo;
- static public URI restoration;
- static public URI scopeNote;
- static public URI shelfmarkLocation;
- static public URI sponsor;
- static public URI studentOf;
- static public URI subtitle;
- static public URI subtitleTransliteration;
- static public URI titleTransliteration;
- static public URI wasStudiedBy;
- static public URI wasTaughtBy;
- static public URI watermark;
- static public URI writer;
- static public URI writtenAt;
- static public URI writtenAreaDimension;
-
- static {
- f = ValueFactoryImpl.getInstance();
-
- //http://onto.dm2e.eu/schemas/dm2e/1.0/#Manuscript
- dm2eOnto10 = f.createURI("http://onto.dm2e.eu/schemas/dm2e/");
- Archive = f.createURI(dm2eOnto10 + "Collection");
- Collection = f.createURI(dm2eOnto10 + "Collection");
- Document = f.createURI(dm2eOnto10 + "Document");
- File = f.createURI(dm2eOnto10 + "File");
- Manuscript = f.createURI(dm2eOnto10 + "Manuscript");
- Paragraph = f.createURI(dm2eOnto10 + "Paragraph");
- Photo = f.createURI(dm2eOnto10 + "Photo");
- Publication = f.createURI(dm2eOnto10 + "Publication");
- Work = f.createURI(dm2eOnto10 + "Publication");
-
-
- //Page = f.createURI("http://purl.org/spar/fabio/Page");
- // Page now served by dm2e
- Page = f.createURI(dm2eOnto10 + "Page");
- Book = f.createURI("http://purl.org/ontology/bibo/Book");
-
- //Properties
-
- artist = f.createURI(dm2eOnto10 + "artist");
- callNumber = f.createURI(dm2eOnto10 + "callNumber");
- composer = f.createURI(dm2eOnto10 + "composer");
- condition = f.createURI(dm2eOnto10 + "condition");
- contributor = f.createURI(dm2eOnto10 + "contributor");
- copyist = f.createURI(dm2eOnto10 + "copyist");
- explicit = f.createURI(dm2eOnto10 + "explicit");
- hasPartCHO = f.createURI(dm2eOnto10 + "hasPartCHO");
- hasPartPlace = f.createURI(dm2eOnto10 + "hasPartPlace");
- hasPartTimeSpan = f.createURI(dm2eOnto10 + "hasPartTimeSpan");
- hasPartWebResource = f.createURI(dm2eOnto10 + "hasPartWebResource");
- honoree = f.createURI(dm2eOnto10 + "honoree");
- illustration = f.createURI(dm2eOnto10 + "illustration");
- incipit = f.createURI(dm2eOnto10 + "incipit");
- influencedBy = f.createURI(dm2eOnto10 + "influencedBy");
- isDerivativeOfCHO = f.createURI(dm2eOnto10 + "isDerivativeOfCHO");
- isDerivativeOfWebResource = f.createURI(dm2eOnto10 + "isDerivativeOfWebResource");
- isPartOfCHO = f.createURI(dm2eOnto10 + "isPartOfCHO");
- isPartOfPlace = f.createURI(dm2eOnto10 + "isPartOfPlace");
- isPartOfTimeSpan = f.createURI(dm2eOnto10 + "isPartOfTimeSpan");
- isPartOfWebResource = f.createURI(dm2eOnto10 + "isPartOfWebResource");
- levelOfGenesis = f.createURI(dm2eOnto10 + "levelOfGenesis");
- mentioned = f.createURI(dm2eOnto10 + "mentioned");
- misattributed = f.createURI(dm2eOnto10 + "misattributed");
- owner = f.createURI(dm2eOnto10 + "owner");
- pageDimension = f.createURI(dm2eOnto10 + "pageDimension");
- painter = f.createURI(dm2eOnto10 + "painter");
- patron = f.createURI(dm2eOnto10 + "patron");
- portrayed = f.createURI(dm2eOnto10 + "portrayed");
- previousOwner = f.createURI(dm2eOnto10 + "previousOwner");
- principal = f.createURI(dm2eOnto10 + "principal");
- printedAt = f.createURI(dm2eOnto10 + "printedAt");
- publishedAt = f.createURI(dm2eOnto10 + "publishedAt");
- refersTo = f.createURI(dm2eOnto10 + "refersTo");
- restoration = f.createURI(dm2eOnto10 + "restoration");
- scopeNote = f.createURI(dm2eOnto10 + "scopeNote");
- shelfmarkLocation = f.createURI(dm2eOnto10 + "shelfmarkLocation");
- sponsor = f.createURI(dm2eOnto10 + "sponsor");
- studentOf = f.createURI(dm2eOnto10 + "studentOf");
- subtitle = f.createURI(dm2eOnto10 + "subtitle");
- subtitleTransliteration = f.createURI(dm2eOnto10 + "subtitleTransliteration");
- titleTransliteration = f.createURI(dm2eOnto10 + "titleTransliteration");
- wasStudiedBy = f.createURI(dm2eOnto10 + "wasStudiedBy");
- wasTaughtBy = f.createURI(dm2eOnto10 + "wasTaughtBy");
- watermark = f.createURI(dm2eOnto10 + "watermark");
- writer = f.createURI(dm2eOnto10 + "writer");
- writtenAreaDimension = f.createURI(dm2eOnto10 + "writtenAreaDimension");
- writtenAt = f.createURI(dm2eOnto10 + "writtenAt");
-
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/DM2ECodexConverter.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/DM2ECodexConverter.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.mpi.openmind.cache.WrapperService;
-import org.mpi.openmind.repository.bo.Entity;
-import org.mpi.openmind.repository.services.ServiceRegistry;
-import org.mpi.openmind.repository.utils.OMUtils;
-import org.openrdf.model.Literal;
-import org.openrdf.model.Model;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-
-import de.mpiwg.itgroup.dm2e.utils.EDM;
-import de.mpiwg.itgroup.ismi.utils.templates.CodexTemplate;
-
-public class DM2ECodexConverter {
-
-
- public static URI getProvidedCHO(CodexTemplate codexTempl,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- String identifier = (StringUtils.isNotEmpty(codexTempl.mpiwgId)) ? codexTempl.mpiwgId : codexTempl.id.toString();
-
- URI providedCHO = f.createURI(NameSpaces.edmProvidedCHO, identifier);
-
- //
- Literal title = f.createLiteral(codexTempl.ov, "en");
- g.add(f.createStatement(providedCHO, URIUtils.dcTitle, title));
-
- // uri edm providedcho
- g.add(f.createStatement(providedCHO, URIUtils.rdfType, f.createURI("http://www.europeana.eu/schemas/edm/ProvidedCHO")));
-
- //dc:type -> Specialisation of edm:PhysicalThing
- g.add(f.createStatement(providedCHO, URIUtils.dcType, DM2E.Manuscript));
-
- g.add(f.createStatement(providedCHO, URIUtils.dm2eLevelOfHierarchy, f.createLiteral(1)));
-
- //edm:type -> Literal
- g.add(f.createStatement(providedCHO, URIUtils.edmType, f.createLiteral("TEXT")));
-
- String description = getDescription(codexTempl);
- g.add(f.createStatement(providedCHO, URIUtils.dcDescription, f.createLiteral(description)));
-
- g.add(f.createStatement(providedCHO, URIUtils.dcLanguage, f.createLiteral("ar")));
-
- //TODO: Places
-
- g.add(f.createStatement(providedCHO, URIUtils.dcIdentifier, f.createLiteral(identifier)));
-
- //dm2eCallNumber
- g.add(f.createStatement(providedCHO, URIUtils.dm2eCallNumber, f.createLiteral(codexTempl.identifier)));
-
-
- for(String subject : OMUtils.resolveQuery(codexTempl.id, "CODEX|target:is_part_of|WITNESS|source:is_exemplar_of|TEXT|source:has_subject|SUBJECT", wrapper, null)){
- URI uriConcept = f.createURI("http://data.dm2e.eu/data/concept/mpiwg/authority_ismi/" + DM2EUtils.encodeString(subject));
- g.add(f.createStatement(uriConcept, URIUtils.rdfType, URIUtils.skosConcept));
- g.add(f.createStatement(providedCHO, URIUtils.dcSubject, uriConcept));
- g.add(f.createStatement(uriConcept, URIUtils.skosPrefLabel, f.createLiteral(subject, "en")));
- }
-
- //AddAgents.execute(g, f, providedCHO, witnessTempl, wrapper);
-
- //dm2e:writtenAt
- for(String placeWrittenAt : OMUtils.resolveQuery(codexTempl.id, "CODEX|target:is_part_of|WITNESS|source:was_created_in|PLACE", wrapper, null)){
- URI uriPlace = f.createURI(NameSpaces.edmPlace + codexTempl.id + "/" + DM2EUtils.generateID() + "_" + DM2EUtils.encodeString(placeWrittenAt));
- g.add(f.createStatement(uriPlace, f.createURI("http://www.w3.org/2004/02/skos/core#prefLabel"), f.createLiteral(placeWrittenAt, "en")));
- g.add(f.createStatement(providedCHO, DM2E.writtenAt, uriPlace));
- g.add(f.createStatement(uriPlace, URIUtils.rdfType, URIUtils.edmPlace));
- }
-
-
- //pro:author
- for(String personId : OMUtils.resolveQuery(codexTempl.id, "CODEX|target:is_part_of|WITNESS|source:is_exemplar_of|TEXT|source:was_created_by|PERSON:id", wrapper, null)){
-
- Entity person = wrapper.getEntityById(Long.parseLong(personId));
-
- URI uriPerson = f.createURI(
- "http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/" + codexTempl.identifier + "/" + DM2EUtils.generateID() + "_" + personId);
- g.add(f.createStatement(uriPerson, URIUtils.skosPrefLabel, f.createLiteral(person.getOwnValue())));
- g.add(f.createStatement(uriPerson, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Person")));
- g.add(f.createStatement(providedCHO, URIUtils.proAuthor, uriPerson));
- }
-
- return providedCHO;
- }
-
- public static URI getAggregation(CodexTemplate codexTemp,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- URI aggregation = f.createURI(NameSpaces.oreAggregation, codexTemp.mpiwgId);
-
- //edm:provider
- URI provider = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/DM2E");
- g.add(f.createStatement(aggregation, URIUtils.rdfType, f.createURI("http://www.openarchives.org/ore/terms/Aggregation")));
- g.add(f.createStatement(aggregation, URIUtils.edmProvider, provider));
- g.add(f.createStatement(provider, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Organization")));
- g.add(f.createStatement(provider, URIUtils.skosPrefLabel, f.createLiteral("DM2E", "en")));
- g.add(f.createStatement(provider, URIUtils.skosAltLabel, f.createLiteral("Digitised Manuscripts to Europeana", "en")));
-
- //data provider
- URI dataProvider = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/MPIWG");
- g.add(f.createStatement(aggregation, URIUtils.edmDataProvider, dataProvider));
- g.add(f.createStatement(dataProvider, URIUtils.skosPrefLabel, f.createLiteral("Max Planck Institute for the History of Science", "en")));
- g.add(f.createStatement(dataProvider, URIUtils.skosPrefLabel, f.createLiteral("Max-Planck-Institut für Wissenschaftsgeschichte", "de")));
- g.add(f.createStatement(dataProvider, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Organization")));
-
- //edm:rights
- g.add(f.createStatement(aggregation, URIUtils.edmRights, f.createURI(DM2EConverter.RIGHTS)));
-
- //dm2e:displayLevel mandatory
- g.add(f.createStatement(aggregation, URIUtils.dm2eDisplayLevel, f.createLiteral(true)));
-
- //dcterms:created
- Entity witnessEnt = wrapper.getEntityById(codexTemp.id);
- Date created = new Date(witnessEnt.getModificationTime());
-
- g.add(f.createStatement(aggregation, URIUtils.dctCreated,
- f.createLiteral(DM2EConverter.timeFormat.format(created),
- f.createURI("http://www.w3.org/2001/XMLSchema#dateTime"))));
-
- addIsShownAt(codexTemp, aggregation, wrapper, g, f);
- addLandingPageObject(codexTemp, aggregation, wrapper, g, f);
-
- return aggregation;
- }
-
- private static URI addLandingPageObject(CodexTemplate codexTemp, URI agg,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- String indexmetaDir = codexTemp.indexmetaFolder.replace("/mpiwg/online", "");
-
-
- URI ws = f.createURI("http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?dw=50&fn=" + indexmetaDir + "/pageimg");
-
- g.add(f.createStatement(ws, f.createURI("http://purl.org/dc/elements/1.1/format"), f.createLiteral("image/jpeg")));
- g.add(f.createStatement(ws, URIUtils.dcDescription, f.createLiteral("Landing page of codex: " + codexTemp.ov)));
-
- //edm:rights [any URL] mandatory
- g.add(f.createStatement(ws, EDM.rights, f.createLiteral(DM2EConverter.RIGHTS)));
-
- g.add(f.createStatement(agg, EDM.object, ws));
- // KT added type
- g.add(f.createStatement(ws, URIUtils.rdfType, EDM.WebResource));
-
- return ws;
- }
-
- private static URI addIsShownAt(CodexTemplate codexTemp, URI agg,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- URI ws = f.createURI(
- "http://echo.mpiwg-berlin.mpg.de/" + codexTemp.mpiwgId);
-
- g.add(f.createStatement(ws, f.createURI("http://purl.org/dc/elements/1.1/format"), f.createLiteral("text/html-named-content")));
- g.add(f.createStatement(ws, URIUtils.dcDescription, f.createLiteral("ECHO View of codex: " + codexTemp.ov)));
-
- //edm:rights [any URL] mandatory
- g.add(f.createStatement(ws, EDM.rights, f.createLiteral(DM2EConverter.RIGHTS)));
-
- g.add(f.createStatement(agg, EDM.isShownAt,ws));
-
- g.add(f.createStatement(ws, URIUtils.rdfType, EDM.WebResource));
-
- return ws;
- }
-
-
- private static String getDescription(CodexTemplate temp){
- //TODO it can be improved!
- return "Codex: " + temp.ov;
- }
-
- public static void main(String[] args){
-
- ServiceRegistry sr = new ServiceRegistry();
-
- try {
- //List rs = OMUtils.resolveQuery(new Long(4202), "CODEX|target:is_part_of|WITNESS|source:is_exemplar_of|TEXT|source:has_subject|SUBJECT", sr.getWrapper());
- //List rs = OMUtils.resolveQuery(new Long(159098), "CODEX|target:is_part_of|WITNESS|source:is_exemplar_of|TEXT|source:was_created_in|PLACE", sr.getWrapper());
-
- List rs = OMUtils.resolveQuery(new Long(159098), "CODEX|target:is_part_of|WITNESS|source:is_exemplar_of|TEXT|source:was_created_by|PERSON:id", sr.getWrapper(), null);
-
- for(String s : rs){
- System.out.println(s);
- }
- System.out.println(rs.size());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.exit(0);
-
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/DM2EConverter.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/DM2EConverter.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.mpi.openmind.cache.WrapperService;
-import org.mpi.openmind.repository.bo.Entity;
-import org.mpi.openmind.repository.services.ServiceRegistry;
-import org.openrdf.model.Model;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.LinkedHashModel;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFHandlerException;
-import org.openrdf.rio.RDFWriter;
-import org.openrdf.rio.Rio;
-
-import de.mpiwg.itgroup.dm2e.utils.EDM;
-import de.mpiwg.itgroup.ismi.utils.templates.CodexTemplate;
-import de.mpiwg.itgroup.ismi.utils.templates.WitnessTemplate;
-
-
-public class DM2EConverter {
-
- private static List codexIdList = new ArrayList();
- static{
- codexIdList.add(new Long(27543));
- codexIdList.add(new Long(36745));
- codexIdList.add(new Long(58453));
- codexIdList.add(new Long(87298));
- codexIdList.add(new Long(259646));
- codexIdList.add(new Long(35093));
- codexIdList.add(new Long(22863));
- codexIdList.add(new Long(34870));
- codexIdList.add(new Long(36882));
- codexIdList.add(new Long(101488));
- codexIdList.add(new Long(36696));
- codexIdList.add(new Long(31794));
- codexIdList.add(new Long(37240));
- codexIdList.add(new Long(35014));
- codexIdList.add(new Long(35583));
- codexIdList.add(new Long(37025));
- codexIdList.add(new Long(35960));
- codexIdList.add(new Long(172492));
- codexIdList.add(new Long(98286));
- codexIdList.add(new Long(165721));
- codexIdList.add(new Long(260111));
- codexIdList.add(new Long(90980));
- codexIdList.add(new Long(36316));
- codexIdList.add(new Long(260120));
- codexIdList.add(new Long(36241));
- codexIdList.add(new Long(260129));
- codexIdList.add(new Long(260138));
- codexIdList.add(new Long(38860));
- codexIdList.add(new Long(176694));
- codexIdList.add(new Long(72545));
- codexIdList.add(new Long(36185));
- codexIdList.add(new Long(36575));
- codexIdList.add(new Long(260146));
- codexIdList.add(new Long(31672));
- codexIdList.add(new Long(37739));
- codexIdList.add(new Long(89861));
- codexIdList.add(new Long(176778));
- codexIdList.add(new Long(180743));
- codexIdList.add(new Long(86328));
- codexIdList.add(new Long(260150));
- codexIdList.add(new Long(90658));
- codexIdList.add(new Long(58423));
- codexIdList.add(new Long(181058));
- codexIdList.add(new Long(105948));
- codexIdList.add(new Long(35526));
- codexIdList.add(new Long(74078));
- codexIdList.add(new Long(260158));
- codexIdList.add(new Long(181096));
- codexIdList.add(new Long(31606));
- codexIdList.add(new Long(31568));
- codexIdList.add(new Long(27872));
- codexIdList.add(new Long(36938));
- codexIdList.add(new Long(4836));
- codexIdList.add(new Long(34668));
- codexIdList.add(new Long(76866));
- codexIdList.add(new Long(102230));
- codexIdList.add(new Long(76888));
- codexIdList.add(new Long(74070));
- codexIdList.add(new Long(73757));
- codexIdList.add(new Long(182685));
- codexIdList.add(new Long(260162));
- codexIdList.add(new Long(260170));
- codexIdList.add(new Long(1102));
- codexIdList.add(new Long(172888));
- codexIdList.add(new Long(260174));
- codexIdList.add(new Long(34806));
- codexIdList.add(new Long(28088));
- codexIdList.add(new Long(36713));
- codexIdList.add(new Long(37323));
- codexIdList.add(new Long(34551));
- codexIdList.add(new Long(35943));
- codexIdList.add(new Long(98095));
- codexIdList.add(new Long(260178));
- codexIdList.add(new Long(260182));
- codexIdList.add(new Long(182770));
- codexIdList.add(new Long(260186));
- codexIdList.add(new Long(260190));
- codexIdList.add(new Long(260194));
- codexIdList.add(new Long(36114));
- codexIdList.add(new Long(85003));
- codexIdList.add(new Long(31630));
- codexIdList.add(new Long(157290));
- codexIdList.add(new Long(37153));
- codexIdList.add(new Long(37213));
- codexIdList.add(new Long(172952));
- codexIdList.add(new Long(86871));
- codexIdList.add(new Long(64406));
- codexIdList.add(new Long(102590));
- codexIdList.add(new Long(82615));
- codexIdList.add(new Long(58245));
- codexIdList.add(new Long(179791));
- codexIdList.add(new Long(179550));
- codexIdList.add(new Long(12419));
- codexIdList.add(new Long(95861));
- codexIdList.add(new Long(36429));
- codexIdList.add(new Long(36099));
- codexIdList.add(new Long(74237));
- codexIdList.add(new Long(36065));
- codexIdList.add(new Long(74822));
- codexIdList.add(new Long(87549));
- codexIdList.add(new Long(83765));
- codexIdList.add(new Long(36733));
- codexIdList.add(new Long(19259));
- codexIdList.add(new Long(260198));
- codexIdList.add(new Long(34986));
- codexIdList.add(new Long(88041));
- codexIdList.add(new Long(260202));
- codexIdList.add(new Long(36550));
- codexIdList.add(new Long(260206));
- codexIdList.add(new Long(37228));
- codexIdList.add(new Long(39880));
- codexIdList.add(new Long(36318));
- codexIdList.add(new Long(36597));
- codexIdList.add(new Long(35035));
- codexIdList.add(new Long(58328));
- codexIdList.add(new Long(80831));
- codexIdList.add(new Long(58354));
- codexIdList.add(new Long(74277));
- codexIdList.add(new Long(36529));
- codexIdList.add(new Long(36380));
- codexIdList.add(new Long(69450));
- codexIdList.add(new Long(200246));
- codexIdList.add(new Long(260222));
- codexIdList.add(new Long(81178));
- codexIdList.add(new Long(260226));
- codexIdList.add(new Long(199952));
- codexIdList.add(new Long(262557));
- codexIdList.add(new Long(87212));
- codexIdList.add(new Long(99059));
- codexIdList.add(new Long(64270));
- codexIdList.add(new Long(81811));
- codexIdList.add(new Long(65785));
- codexIdList.add(new Long(36645));
- }
-
-
-
- public static SimpleDateFormat timeFormat = new SimpleDateFormat("yyy-mm-dd'T'hh:mm:ss");
- //private static String RIGHTS = "http://www.mpiwg-berlin.mpg.de/en/institute/licences.html";
- public static String RIGHTS = "http://www.europeana.eu/portal/rights/rr-f.html";
-
- public static String formatRdfXml = "rdf-xml";
- public static String formatRdfJson = "rdf-json";
- public static String formatNTripes = "ntriples";
-
- public static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd_HH.mm");
-
- public static void convertCodexList(String file, String output, List list, WrapperService wrapper) throws Exception{
-
- Model g = new LinkedHashModel();
- ValueFactory f = ValueFactoryImpl.getInstance();
-
- int counter = 0;
- for(Long codexId : list){
-
- Entity codex = wrapper.getEntityById(codexId);
- if(codex != null && StringUtils.equals(codex.getObjectClass(), "CODEX")){
- CodexTemplate codexTempl = new CodexTemplate(codex, wrapper);
- if(StringUtils.isNotEmpty(codexTempl.mpiwgId)){
- URI providedCHO = DM2ECodexConverter.getProvidedCHO(codexTempl, wrapper, g, f);
- URI aggregation = DM2ECodexConverter.getAggregation(codexTempl, wrapper, g, f);
- g.add(aggregation, EDM.aggregatedCHO, providedCHO);
- counter++;
- }
- }
- }
-
-
- System.out.println("Transformed " + counter + " of " + list.size());
-
- write(file, output, g);
- }
-
- public void convertCodexList(String file, String output, WrapperService wrapper, Long... list) throws Exception{
- convertCodexList(file, output, Arrays.asList(list), wrapper);
- }
-
- public static void convertCodex(String file, String output, Long codexId, WrapperService wrapper) throws Exception{
-
- Model g = new LinkedHashModel();
- ValueFactory f = ValueFactoryImpl.getInstance();
-
- Entity codex = wrapper.getEntityById(codexId);
- if(codex != null && StringUtils.equals(codex.getObjectClass(), "CODEX")){
- CodexTemplate codexTempl = new CodexTemplate(codex, wrapper);
- if(StringUtils.isNotEmpty(codexTempl.mpiwgId)){
- URI providedCHO = DM2ECodexConverter.getProvidedCHO(codexTempl, wrapper, g, f);
- URI aggregation = DM2ECodexConverter.getAggregation(codexTempl, wrapper, g, f);
- g.add(aggregation, EDM.aggregatedCHO, providedCHO);
- write(file, output, g);
- }
- }
-
-
- }
-
-
-
- public void convertWitnessList(String file, String output, WrapperService wrapper, Long... list) throws Exception{
-
- Model g = new LinkedHashModel();
- ValueFactory f = ValueFactoryImpl.getInstance();
-
- for(Long id : list){
- Entity witness = wrapper.getEntityById(id);
-
- if(witness != null && witness.getObjectClass().equals("WITNESS")){
- WitnessTemplate witnessTempl = new WitnessTemplate(witness, wrapper, true, true);
- if(witnessTempl.hasTitle()){
- URI providedCHO = DM2EWitnessConverter.getProvidedCHO(witnessTempl, wrapper, g, f);
- URI aggregation = DM2EWitnessConverter.getAggregation(witnessTempl, wrapper, g, f);
- g.add(aggregation, EDM.aggregatedCHO, providedCHO);
- }
- }else{
-
- }
- }
- write(file, output, g);
- }
-
- public void execute0(String file, String output, WrapperService wrapper) throws Exception{
-
- Model g = new LinkedHashModel();
- ValueFactory f = ValueFactoryImpl.getInstance();
-
- for(Entity witness : wrapper.getEntitiesByDef("WITNESS")){
- WitnessTemplate witnessTempl = new WitnessTemplate(witness, wrapper, true, true);
- if(witnessTempl.hasTitle()){
- URI providedCHO = DM2EWitnessConverter.getProvidedCHO(witnessTempl, wrapper, g, f);
- URI aggregation = DM2EWitnessConverter.getAggregation(witnessTempl, wrapper, g, f);
- g.add(aggregation, EDM.aggregatedCHO, providedCHO);
- }
- }
- write(file, output, g);
- }
-
- private static void write(String file, String output, Model g) throws RDFHandlerException, IOException{
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- FileOutputStream fos = null;
- RDFWriter writer = null;
-
- if(formatRdfXml.equals(output)){
- writer = Rio.createWriter(RDFFormat.RDFXML, out);
- }else if(formatRdfJson.equals(output)){
- writer = Rio.createWriter(RDFFormat.RDFJSON, out);
- }else if(formatNTripes.equals(output)){
- writer = Rio.createWriter(RDFFormat.NTRIPLES , out);
- }
-
- writer.startRDF();
- for (Statement st : g) {
- writer.handleStatement(st);
- }
- writer.endRDF();
-
- try {
- fos = new FileOutputStream (new File(file));
- out.writeTo(fos);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- fos.close();
- }
- }
-
- /**
- * Execute with maven:
- * mvn exec:java -Dexec.mainClass="de.mpiwg.itgroup.dm2e.DM2EConverter" -Dexec.args="/Users/jurzua/ismi_dm2e ntriples"
- * @param args
- */
- public static void main(String[] args){
-
- System.out.println("***************************");
- System.out.println("### DM2EConverter ###");
-
- try {
- String output = (args.length > 1) ? args[1] : formatNTripes;
-
-
- String folder = DATE_FORMAT.format(new Date());
- folder = args[0] + "/" + folder;
- File file = new File(folder);
- file.mkdirs();
-
- WrapperService wrapper = (new ServiceRegistry()).getWrapper();
-
- for(Long codexId : codexIdList){
- convertCodex(folder + "/" + codexId + ".nt", output, codexId, wrapper);
- System.out.print("*");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
-
- /*
- Long[] codicesList = {(long) 35093};
-
- try {
-
-
- converter.convertCodexList(args[0], output, codexIdList);
-
- //converter.convertWitnessList(args[0], output, list);
- //converter.execute(args[0], output);
- } catch (Exception e) {
- e.printStackTrace();
- e.printStackTrace();
- }
- */
- System.out.println("### Finished ###");
- System.out.println("***************************");
- System.exit(0);
- }
-
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/DM2EUtils.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/DM2EUtils.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import java.net.URLEncoder;
-
-import org.apache.commons.lang.RandomStringUtils;
-
-public class DM2EUtils {
-
- public static String encodeString(String toURI) throws Exception {
- toURI = toURI.replaceAll("/|:|<|>|,","_");
- toURI = URLEncoder.encode(toURI,"UTF-8");
- toURI = toURI.replace("+", "_");
- toURI = toURI.replace("__", "_");
-
- return toURI;
- }
-
- public static String generateID(){
- return RandomStringUtils.randomAlphabetic(1) + RandomStringUtils.randomAlphanumeric(6);
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/DM2EWitnessConverter.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/DM2EWitnessConverter.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.mpi.openmind.cache.WrapperService;
-import org.mpi.openmind.repository.bo.Attribute;
-import org.mpi.openmind.repository.bo.Entity;
-import org.openrdf.model.Model;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-
-import de.mpiwg.itgroup.dm2e.utils.DM2EUtils;
-import de.mpiwg.itgroup.dm2e.utils.EDM;
-import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar;
-import de.mpiwg.itgroup.ismi.utils.templates.WitnessTemplate;
-
-public class DM2EWitnessConverter {
-
-
- public static URI getProvidedCHO(WitnessTemplate witnessTempl,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- System.out.println("\tgetProvidedCHO witness: " + witnessTempl.id);
-
- URI providedCHO = f.createURI(NameSpaces.edmProvidedCHO, witnessTempl.id.toString());
-
- // uri edm providedcho
- g.add(f.createStatement(providedCHO, URIUtils.rdfType, f.createURI("http://www.europeana.eu/schemas/edm/ProvidedCHO")));
-
- //dc:type -> Specialisation of edm:PhysicalThing
- g.add(f.createStatement(providedCHO, URIUtils.dcType, DM2E.Manuscript));
-
- g.add(f.createStatement(providedCHO, URIUtils.dm2eLevelOfHierarchy, f.createLiteral(1)));
-
- //edm:type -> Literal
- g.add(f.createStatement(providedCHO, URIUtils.edmType, f.createLiteral("TEXT")));
-
- String description = getDescription(witnessTempl);
- g.add(f.createStatement(providedCHO, URIUtils.dcDescription, f.createLiteral(description)));
-
- //Literal label = (StringUtils.isNotEmpty(title.lang)) ? f.createLiteral(title.label, title.lang) : f.createLiteral(title.label);
- //TODO language of the title??
- g.add(f.createStatement(providedCHO, URIUtils.dcTitle, f.createLiteral(witnessTempl.title)));
-
- //TODO alternative title, arabic translitareation??
- //g.add(f.createStatement(providedCHO, URIUtils.dctAlternative, label));
-
-
- if(StringUtils.isNotEmpty(witnessTempl.incipit))
- g.add(f.createStatement(providedCHO, URIUtils.dm2eIncipit, f.createLiteral(witnessTempl.incipit)));
-
- if(StringUtils.isNotEmpty(witnessTempl.explicit))
- g.add(f.createStatement(providedCHO, URIUtils.dm2eExplicit, f.createLiteral(witnessTempl.explicit)));
-
- g.add(f.createStatement(providedCHO, URIUtils.dcLanguage, f.createLiteral("ar")));
-
- //TODO: Places
-
- g.add(f.createStatement(providedCHO, URIUtils.dcIdentifier, f.createLiteral(witnessTempl.id.toString())));
-
- //dm2eCallNumber
- if(StringUtils.isNotEmpty(witnessTempl.codex))
- g.add(f.createStatement(providedCHO, URIUtils.dm2eCallNumber, f.createLiteral(witnessTempl.codex)));
-
- //g.add(f.createStatement(providedCHO, URIUtils.biboNumPages, f.createLiteral(r.meta.bib.numberOfPages)));
-
- //g.add(f.createStatement(providedCHO, URIUtils.biboNumVolumes, f.createLiteral(r.meta.bib.numberOfVolumes)));
-
- //g.add(f.createStatement(providedCHO, URIUtils.dcPublisher, f.createLiteral(publisher)));
-
-
-
- // .
- // .
- //
-
-
- if(StringUtils.isNotEmpty(witnessTempl.subject)){
- URI uriConcept = f.createURI("http://data.dm2e.eu/data/concept/mpiwg/authority_ismi/" + witnessTempl.subject);
- g.add(f.createStatement(uriConcept, URIUtils.rdfType, URIUtils.skosConcept));
- g.add(f.createStatement(providedCHO, URIUtils.dcSubject, uriConcept));
- g.add(f.createStatement(uriConcept, URIUtils.skosPrefLabel, f.createLiteral(witnessTempl.subject, "en")));
- }
-
-
- AddAgents.execute(g, f, providedCHO, witnessTempl, wrapper);
-
- //dm2e:writtenAt
-
- List list = wrapper.getTargetsForSourceRelation(witnessTempl.titleId, "was_created_in", "PLACE", 1);
- if(list.size() > 0){
- Entity place = list.get(0);
- URI uriPlace = f.createURI(NameSpaces.edmPlace + witnessTempl.id + "/" + DM2EUtils.generateID() + "_" + DM2EUtils.encodeString(place.getOwnValue()));
- g.add(f.createStatement(uriPlace, f.createURI("http://www.w3.org/2004/02/skos/core#prefLabel"), f.createLiteral(place.getOwnValue(), "en")));
- g.add(f.createStatement(providedCHO, DM2E.publishedAt, uriPlace));
- g.add(f.createStatement(uriPlace, URIUtils.rdfType, URIUtils.edmPlace));
- }
-
-
- //TEXT.creation_date -> dcterms:issued
-
- Attribute attCreationDate = wrapper.getAttributeByName(witnessTempl.titleId , "creation_date");
- if(attCreationDate != null && StringUtils.isNotEmpty(attCreationDate.getOwnValue())){
- Calendar creationDate = new Calendar(attCreationDate.getOwnValue());
-
- if(Calendar.STATE_KNOWN.equals(creationDate.getState())){
-
- //"2000-01-01T00:00:00"
- String begin = null;
- String end = null;
- URI timespanIssued = null;
-
- begin = creationDate.getFromGregorian().getYear() + "-" +
- ((creationDate.getFromGregorian().getMonth() < 10) ? "0" + creationDate.getFromGregorian().getMonth() : creationDate.getFromGregorian().getMonth()) + "-" +
- ((creationDate.getFromGregorian().getDayOfMonth() < 10) ? "0" + creationDate.getFromGregorian().getDayOfMonth() : creationDate.getFromGregorian().getDayOfMonth()) + "T00:00:00";
-
- if(!Calendar.INPUT_FORM_DATE.equals(creationDate.getInputForm())){
- end = creationDate.getUntilGregorian().getYear() + "-" +
- ((creationDate.getUntilGregorian().getMonth() < 10) ? "0" + creationDate.getUntilGregorian().getMonth() : creationDate.getUntilGregorian().getMonth()) + "-" +
- ((creationDate.getUntilGregorian().getDayOfMonth() < 10) ? "0" + creationDate.getUntilGregorian().getDayOfMonth() : creationDate.getUntilGregorian().getDayOfMonth()) + "T23:59:59";
-
-
- }
- if(StringUtils.isEmpty(end)){
- timespanIssued = f.createURI(NameSpaces.edmTimespan + begin.replace(":", "_") + "UG");
- }else{
- timespanIssued = f.createURI(NameSpaces.edmTimespan + begin.replace(":", "_") + "UG_" + end.replace(":", "_") + "UG");
- g.add(f.createStatement(timespanIssued, URIUtils.edmEnd, f.createLiteral(end, f.createURI("http://www.w3.org/2001/XMLSchema#dateTime"))));
- g.add(f.createStatement(timespanIssued, URIUtils.cidocEndQual, f.createLiteral("uncertainty_granularity")));
- }
-
- g.add(f.createStatement(timespanIssued, URIUtils.rdfType, URIUtils.edmTimeSpan));
- //g.add(f.createStatement(timespanIssued, URIUtils.skosPrefLabel, f.createLiteral(dateString)));
- g.add(f.createStatement(timespanIssued, URIUtils.edmBegin, f.createLiteral(begin, f.createURI("http://www.w3.org/2001/XMLSchema#dateTime"))));
- g.add(f.createStatement(timespanIssued, URIUtils.cidocBeginQual, f.createLiteral("uncertainty_granularity")));
- g.add(f.createStatement(providedCHO, URIUtils.dctIssued, timespanIssued));
- }
- }
-
- return providedCHO;
- }
-
- public static URI getAggregation(WitnessTemplate witness,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
- //URI aggregation = f.createURI(NameSpaces.oreAggregation, "MPIWG:" + r.indexMetaId);
- URI aggregation = f.createURI(NameSpaces.oreAggregation, witness.id.toString());
-
- //edm:provider
- URI provider = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/DM2E");
- g.add(f.createStatement(aggregation, URIUtils.rdfType, f.createURI("http://www.openarchives.org/ore/terms/Aggregation")));
- g.add(f.createStatement(aggregation, URIUtils.edmProvider, provider));
- g.add(f.createStatement(provider, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Organization")));
- g.add(f.createStatement(provider, URIUtils.skosPrefLabel, f.createLiteral("DM2E", "en")));
- g.add(f.createStatement(provider, URIUtils.skosAltLabel, f.createLiteral("Digitised Manuscripts to Europeana", "en")));
-
- //data provider
- URI dataProvider = f.createURI("http://data.dm2e.eu/data/agent/mpiwg/" + NameSpaces.mpiwgCollection + "/MPIWG");
- g.add(f.createStatement(aggregation, URIUtils.edmDataProvider, dataProvider));
- g.add(f.createStatement(dataProvider, URIUtils.skosPrefLabel, f.createLiteral("Max Planck Institute for the History of Science", "en")));
- g.add(f.createStatement(dataProvider, URIUtils.skosPrefLabel, f.createLiteral("Max-Planck-Institut für Wissenschaftsgeschichte", "de")));
- g.add(f.createStatement(dataProvider, URIUtils.rdfType, f.createURI("http://xmlns.com/foaf/0.1/Organization")));
-
- //edm:rights
- g.add(f.createStatement(aggregation, URIUtils.edmRights, f.createURI(DM2EConverter.RIGHTS)));
-
- //dm2e:displayLevel mandatory
- g.add(f.createStatement(aggregation, URIUtils.dm2eDisplayLevel, f.createLiteral(true)));
-
- //dcterms:created
- Entity witnessEnt = wrapper.getEntityById(witness.id);
- Date created = new Date(witnessEnt.getModificationTime());
-
- g.add(f.createStatement(aggregation, URIUtils.dctCreated,
- f.createLiteral(DM2EConverter.timeFormat.format(created),
- f.createURI("http://www.w3.org/2001/XMLSchema#dateTime"))));
-
- addIsShownAt(witness, aggregation, wrapper, g, f);
-
- return aggregation;
- }
-
- private static URI addIsShownAt(WitnessTemplate witness, URI agg,
- WrapperService wrapper, Model g, ValueFactory f) throws Exception{
-
- URI ws = f.createURI(
- "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/search/displayTitle.xhtml?witnessId=" + witness.id + "#witnesses");
-
- g.add(f.createStatement(ws, f.createURI("http://purl.org/dc/elements/1.1/format"), f.createLiteral("text/html-named-content")));
- g.add(f.createStatement(ws, URIUtils.dcDescription, f.createLiteral("View of witness " + witness.title)));
-
- //edm:rights [any URL] mandatory
- g.add(f.createStatement(ws, EDM.rights, f.createLiteral(DM2EConverter.RIGHTS)));
-
- g.add(f.createStatement(agg, EDM.isShownAt,ws));
-
- g.add(f.createStatement(ws, URIUtils.rdfType, EDM.WebResource));
-
- return ws;
- }
-
- private static String getDescription(WitnessTemplate witnessTempl){
- //TODO it can be improved!
- return "Manuscript " + witnessTempl.title + " is part of the codex " + witnessTempl.codex + ".";
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/NameSpaces.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/NameSpaces.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-public class NameSpaces {
-
-
- //URL Schemes
- public static String rootDM2E = "http://data.dm2e.eu/data/";
- // collection string right now configured in Testing
- //public static String mpiwgCollection = "harriot";
- public static String mpiwgCollection = "ismi";
-
- //skos:Concept
- public static String skosConcept = rootDM2E + "concept/mpiwg/" + mpiwgCollection + "/";
- //edm:Agent
- public static String edmAgent = rootDM2E + "agent/mpiwg/" + mpiwgCollection + "/";
- //edm:Event
- public static String edmEvent = rootDM2E + "event/mpiwg/" + mpiwgCollection + "/";
- //edm:ProvidedCHO
- public static String edmProvidedCHO = rootDM2E + "item/mpiwg/" + mpiwgCollection + "/";
- //edm:Place
- public static String edmPlace = rootDM2E + "place/mpiwg/" + mpiwgCollection + "/" ;
- //edm:TimeSpan
- public static String edmTimespan = rootDM2E + "timespan/mpiwg/" + mpiwgCollection + "/";
- //ore:Aggregation
- public static String oreAggregation = rootDM2E + "aggregation/mpiwg/" + mpiwgCollection + "/";
-
- public static String webResource = rootDM2E + "webresource/mpiwg/" + mpiwgCollection + "/";
-
- //specialized
- public static String oldindexMetaNS = "http://www.mpiwg-berlin.mpg.de/indexMeta/";
- public static String dataProvider = rootDM2E + "agent/mpiwg/" + mpiwgCollection + "/Max%20Planck%20Institute%20For%20The%20History%20Of%20Science";
- public static String provider = rootDM2E + "agent/mpiwg/provider/DM2E";
-
-
- // namespaces
- public static String owl = "http://www.w3.org/2002/07/owl#";
- public static String foaf = "http://xmlns.com/foaf/0.1/";
- public static String rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
- public static String rdfs = "http://www.w3.org/2000/01/rdf-schema#";
-
- public static String dc = "http://purl.org/dc/elements/1.1/";
- public static String dcterms = "http://purl.org/dc/terms/";
- public static String edm = "http://www.europeana.eu/schemas/edm/";
- public static String ore = "http://www.openarchives.org/ore/terms/";
- public static String skos = "http://www.w3.org/2004/02/skos/core#";
- public static String wgs84 = "http://www.w3.org/2003/01/geo/wgs84_pos#";
- public static String bibo = "http://purl.org/ontology/bibo/";
- public static String pro = "http://purl.org/spar/pro/";
- public static String dm2e10 = "http://onto.dm2e.eu/schemas/dm2e/";
- public static String dm2e = "http://onto.dm2e.eu/schemas/dm2e/";
- public static String korbo = "http://purl.org/net7/korbo/vocab#";
-
- // adding all namespaces from owl file
- public static String protege = "http://protege.stanford.edu/plugins/owl/protege#";
- public static String vivo = "http://vivoweb.org/ontology/core#";
- public static String swrla = "http://swrl.stanford.edu/ontologies/3.3/swrla.owl#";
- public static String swrlb = "http://www.w3.org/2003/11/swrlb#";
- public static String sqwrl = "http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#";
- public static String xsd = "http://www.w3.org/2001/XMLSchema#";
- public static String DOLCELite = "http://www.loa-cnr.it/ontologies/DOLCE-Lite.owl#";
- public static String crm = "http://www.cidoc-crm.org/rdfs/cidoc_crm_v5.0.2_english_label.rdfs#";
- public static String wgs84_pos = "http://www.w3.org/2003/01/geo/wgs84_pos#";
- public static String xsp = "http://www.owl-ontologies.com/2005/08/07/xsp.owl#";
- public static String rdfsvoid = "http://rdfs.org/ns/void#";
- public static String rdaGr2 = "http://rdvocab.info/ElementsGr2/";
- public static String fabio = "http://purl.org/spar/fabio/";
- public static String swrl = "http://www.w3.org/2003/11/swrl#";
- public static String cidoc = "http://www.cidoc-crm.org/cidoc-crm/";
-
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/URIUtils.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/URIUtils.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-package de.mpiwg.itgroup.dm2e;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-
-public class URIUtils {
-
- static ValueFactory f;
-
- static public URI ProvidedCHO;
-
- //ore:Aggregation
- static public URI edmAggregatedCHO;
- static public URI edmProvider;
- static public URI edmDataProvider;
- static public URI edmRights;
- static public URI edmHasView;
- static public URI edmObject;
- static public URI dm2eHasAnnotatableVersionAt;
- static public URI dctCreated;
- static public URI dctModified;
- static public URI dm2eHasVersion;
- static public URI dctCreator;
- static public URI dm2eDisplayLevel;
- static public URI dm2eLevelOfHierarchy;
-
- //edm:ProvidedCHO
- static public URI edmType;
- static public URI dcType;
- static public URI dcTitle;
- //static public URI dctTitle;
- static public URI dm2eTitleTransliteration;
- static public URI dm2eSubtitle;
- static public URI dm2eSubtitleTransliteration;
- static public URI dctAlternative;
- static public URI dcDescription;
- //static public URI dctDescription;
- static public URI dcLanguage;
- static public URI dctIssued;
- static public URI dm2ePublishedAt;
- static public URI dcIdentifier;
- static public URI dm2eIsbn;
- static public URI dm2eCallNumber;
- static public URI edmCurrentLocation;
- static public URI edmPlace;
- //TimeSpan
- static public URI edmTimeSpan;
- static public URI edmBegin;
- static public URI edmEnd;
- static public URI cidocBeginQual;
- static public URI cidocEndQual;
- //static public URI edmRights;
- static public URI dcSubject;
- static public URI dctExtent;
- static public URI biboNumPages;
- static public URI biboNumVolumes;
- static public URI biboNumber;
- static public URI dctTableOfContents;
- static public URI dctProvenance;
- static public URI dcFormat;
- static public URI edmIsDerivativeOf;
- static public URI dctHasVersion;
- static public URI dctHasPart;
- static public URI dctIsPartOf;
- static public URI dm2eIsPartOf;
- static public URI dm2eLocatedIn;
- static public URI dctReferences;
- static public URI rdfType;
- static public URI dm2eCondition;
- static public URI dm2eWatermark;
- static public URI dm2eSupport;
- static public URI dm2eRestoration;
- static public URI dm2eReferencedEdition;
- static public URI dm2eReferencedPublication;
- static public URI dm2eRelatedPublication;
- static public URI dm2eLevelOfGenesis;
- static public URI edmHasMet;
- static public URI dm2eIncipit;
- static public URI dm2eExplicit;
- static public URI dm2eColophon;
- static public URI dm2ePageDimension;
- static public URI dm2eWrittenAreaDimensions;
- static public URI dm2eDateOfRemark;
- static public URI dm2eRefersTo;
-
- //personroles
-
- //static public URI dctCreator;
- static public URI dcPublisher;
- static public URI dm2eArtist;
- static public URI dm2eAuthor;
- static public URI dm2eComposer;
- static public URI dm2eContributor;
- static public URI dm2eCopyist;
- static public URI dm2eCopyrightHolder;
- static public URI dm2eEditor;
- static public URI dm2eHonoree;
- static public URI dm2eIllustrator;
- static public URI dm2eLibrary;
- static public URI dm2eMentionedPerson;
- static public URI dm2eMisattributedPerson;
- static public URI dm2ePainter;
- static public URI dm2ePatron;
- static public URI dm2ePortrayedPerson;
- static public URI dm2ePortrayed;
- static public URI dm2ePrinter;
- static public URI dm2ePublisher;
- static public URI dm2eRecipient;
- static public URI dm2eSponsor;
- static public URI dm2eStaff;
- static public URI dm2eSubjectOf;
- static public URI dm2eTranslator;
- static public URI dm2eWriter;
-
- static public URI dcContributor;
- static public URI biboEditor;
- static public URI biboRecipient;
- static public URI proIllustrator;
- static public URI proAuthor;
- static public URI proTranslator;
-
- static public URI skosPrefLabel;
- static public URI skosAltLabel;
- static public URI skosConcept;
-
- static{
- f = ValueFactoryImpl.getInstance();
-
- //ore:Aggregation
- edmAggregatedCHO = f.createURI(NameSpaces.edm + "aggregatedCHO");
- edmProvider = f.createURI(NameSpaces.edm + "provider");
- edmDataProvider = f.createURI(NameSpaces.edm + "dataProvider");
- edmRights = f.createURI(NameSpaces.edm + "rights");
- edmHasView = f.createURI(NameSpaces.edm + "hasView");
- edmObject = f.createURI(NameSpaces.edm + "object");
-
- dm2eHasAnnotatableVersionAt = f.createURI(NameSpaces.dm2e + "hasAnnotatableVersionAt");
- dctCreated = f.createURI(NameSpaces.dcterms + "created");
- dctModified = f.createURI(NameSpaces.dcterms + "modified");
- dm2eHasVersion = f.createURI(NameSpaces.dm2e + "hasVersion");
- dctCreator = f.createURI(NameSpaces.dcterms + "creator");
- dm2eDisplayLevel = f.createURI(NameSpaces.dm2e + "displayLevel");
- dm2eLevelOfHierarchy = f.createURI(NameSpaces.dm2e + "levelOfHierarchy");
-
- //edm:ProvidedCHO
- edmType = f.createURI(NameSpaces.edm + "type");
- dcType = f.createURI(NameSpaces.dc + "type");
- dcTitle = f.createURI(NameSpaces.dc + "title");
- // dctTitle = f.createURI(NameSpaces.dcterms + "title");
- dm2eTitleTransliteration = f.createURI(NameSpaces.dm2e + "titleTransliteration");
- dm2eSubtitle = f.createURI(NameSpaces.dm2e + "subtitle");
- dm2eSubtitleTransliteration = f.createURI(NameSpaces.dm2e + "subtitleTransliteration");
- dctAlternative = f.createURI(NameSpaces.dcterms + "alternative");
- dcDescription = f.createURI(NameSpaces.dc + "description");
- //dctDescription = f.createURI(NameSpaces.dcterms + "description");
- dcLanguage = f.createURI(NameSpaces.dc + "language");
- dctIssued = f.createURI(NameSpaces.dcterms + "issued");
- dm2ePublishedAt = f.createURI(NameSpaces.dm2e + "publishedAt");
- dcIdentifier = f.createURI(NameSpaces.dc + "identifier");
- dm2eIsbn = f.createURI(NameSpaces.dm2e + "isbn");
- dm2eCallNumber = f.createURI(NameSpaces.dm2e + "callNumber");
- edmCurrentLocation = f.createURI(NameSpaces.edm + "currentLocation");
- edmPlace = f.createURI(NameSpaces.edm + "Place");
- //TimeSpan
- edmTimeSpan = f.createURI(NameSpaces.edm + "timeSpan");
- edmBegin = f.createURI(NameSpaces.edm + "begin");
- edmEnd = f.createURI(NameSpaces.edm + "end");
- cidocBeginQual = f.createURI(NameSpaces.cidoc + "P79F.beginning_is_qualified_by");
- cidocEndQual = f.createURI(NameSpaces.cidoc + "P80F.end_is_qualified_by");
- //edmRights;
- dcSubject = f.createURI(NameSpaces.dc + "subject");
- dctExtent = f.createURI(NameSpaces.dcterms + "extent");
- biboNumPages = f.createURI(NameSpaces.bibo + "numPages");
- biboNumVolumes = f.createURI(NameSpaces.bibo + "numVolumes");
- biboNumber = f.createURI(NameSpaces.bibo + "number");
- dctTableOfContents = f.createURI(NameSpaces.dcterms + "tableOfContents");
- dctProvenance = f.createURI(NameSpaces.dcterms + "provenance");
- dcFormat = f.createURI(NameSpaces.dc + "format");
- edmIsDerivativeOf = f.createURI(NameSpaces.edm + "isDerivativeOf");
- dctHasVersion = f.createURI(NameSpaces.dcterms + "hasVersion");
- dctHasPart = f.createURI(NameSpaces.dcterms + "hasPart");
- dctIsPartOf = f.createURI(NameSpaces.dcterms + "isPartOf");
-// dm2eIsPartOf = f.createURI(NameSpaces.dm2e + "isPartOf");
- dm2eLocatedIn = f.createURI(NameSpaces.dm2e + "locatedIn");
- dctReferences = f.createURI(NameSpaces.dcterms + "references");
- rdfType = f.createURI(NameSpaces.rdf + "type");
- dm2eCondition = f.createURI(NameSpaces.dm2e + "condition");
- dm2eWatermark = f.createURI(NameSpaces.dm2e + "watermark");
- dm2eSupport = f.createURI(NameSpaces.dm2e + "support");
- dm2eRestoration = f.createURI(NameSpaces.dm2e + "restoration");
- dm2eReferencedEdition = f.createURI(NameSpaces.dm2e + "referencedEdition");
- dm2eReferencedPublication = f.createURI(NameSpaces.dm2e + "referencedPublication");
- dm2eRelatedPublication = f.createURI(NameSpaces.dm2e + "relatedPublication");
- dm2eLevelOfGenesis = f.createURI(NameSpaces.dm2e + "levelOfGenesis");
- edmHasMet = f.createURI(NameSpaces.edm + "hasMet");
- dm2eIncipit = f.createURI(NameSpaces.dm2e + "incipit");
- dm2eExplicit = f.createURI(NameSpaces.dm2e + "explicit");
- dm2eExplicit = f.createURI(NameSpaces.dm2e + "explicit");
- dm2ePageDimension = f.createURI(NameSpaces.dm2e + "pageDimension");
- dm2eWrittenAreaDimensions = f.createURI(NameSpaces.dm2e + "writtenAreaDimensions");
- dm2eDateOfRemark = f.createURI(NameSpaces.dm2e + "dateOfRemark");
- dm2eRefersTo = f.createURI(NameSpaces.dm2e + "refersTo");
-
- //personroles
-
- //dctCreator = f.createURI(NameSpaces.dc + "");
- dcPublisher = f.createURI(NameSpaces.dc + "publisher");
- dm2eArtist = f.createURI(NameSpaces.dm2e + "artist");
- dm2eAuthor = f.createURI(NameSpaces.dm2e + "author");
- dm2eComposer = f.createURI(NameSpaces.dm2e + "composer");
- dm2eContributor = f.createURI(NameSpaces.dm2e + "contributor");
- dm2eCopyist = f.createURI(NameSpaces.dm2e + "copyist");
- dm2eCopyrightHolder = f.createURI(NameSpaces.dm2e + "copyist");
- dm2eEditor = f.createURI(NameSpaces.dm2e + "editor");
- dm2eHonoree = f.createURI(NameSpaces.dm2e + "honoree");
- dm2eIllustrator = f.createURI(NameSpaces.dm2e + "illustrator");
- dm2eLibrary = f.createURI(NameSpaces.dm2e + "illustrator");
- dm2eMentionedPerson = f.createURI(NameSpaces.dm2e + "mentionedPerson");
- dm2eMisattributedPerson = f.createURI(NameSpaces.dm2e + "mentionedPerson");
- dm2ePainter = f.createURI(NameSpaces.dm2e + "painter");
- dm2ePatron = f.createURI(NameSpaces.dm2e + "patron");
- dm2ePortrayedPerson = f.createURI(NameSpaces.dm2e + "portrayedPerson");
- dm2ePortrayed = f.createURI(NameSpaces.dm2e + "portrayed");
- dm2ePrinter = f.createURI(NameSpaces.dm2e + "printer");
- dm2ePublisher = f.createURI(NameSpaces.dm2e + "printer");
- dm2eRecipient = f.createURI(NameSpaces.dm2e + "recipient");
- dm2eSponsor = f.createURI(NameSpaces.dm2e + "sponsor");
- dm2eStaff = f.createURI(NameSpaces.dm2e + "staff");
- dm2eSubjectOf = f.createURI(NameSpaces.dm2e + "subjectOf");
- dm2eTranslator = f.createURI(NameSpaces.dm2e + "translator");
- dm2eWriter = f.createURI(NameSpaces.dm2e + "writer");
-
- proAuthor = f.createURI(NameSpaces.pro + "author");
- dcContributor = f.createURI(NameSpaces.dc + "contributor");
- biboEditor = f.createURI(NameSpaces.bibo + "editor");
- biboRecipient = f.createURI(NameSpaces.bibo + "recipient");
- proIllustrator = f.createURI(NameSpaces.pro + "illustrator");
- proTranslator = f.createURI(NameSpaces.pro + "translator");
-
- skosPrefLabel = f.createURI(NameSpaces.skos + "prefLabel");
- skosAltLabel = f.createURI(NameSpaces.skos + "altLabel");
- skosConcept = f.createURI(NameSpaces.skos + "Concept");
- }
-
-
-
-
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/utils/DM2EUtils.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/utils/DM2EUtils.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-package de.mpiwg.itgroup.dm2e.utils;
-
-import java.net.URLEncoder;
-
-import org.apache.commons.lang.RandomStringUtils;
-
-public class DM2EUtils {
-
- public static String encodeString(String toURI) throws Exception {
- toURI = toURI.replaceAll("/|:|<|>|,", "_");
- toURI = URLEncoder.encode(toURI, "UTF-8");
- return toURI.replace("+", "_");
- }
-
- public static String generateID(){
- return RandomStringUtils.randomAlphabetic(1) + RandomStringUtils.randomAlphanumeric(6);
- }
-}
\ No newline at end of file
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/dm2e/utils/EDM.java
--- a/src/main/java/de/mpiwg/itgroup/dm2e/utils/EDM.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-package de.mpiwg.itgroup.dm2e.utils;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-
-public class EDM {
-
- static ValueFactory f;
-
- static public String edm;
-
- //classes
- public static URI Agent;
- public static URI EuropeanaAggregation;
- public static URI EuropeanaObject;
- public static URI Event;
- public static URI InformationResource;
- public static URI NonInformationResource;
- public static URI PhysicalThing;
- public static URI Place;
- public static URI ProvidedCHO;
- public static URI TimeSpan;
- public static URI WebResource;
-
- //properties
- public static URI aggregatedCHO;
- public static URI currentLocation;
- public static URI happenedAt;
- public static URI hasMet;
- public static URI hasType;
- public static URI hasView;
- public static URI incorporates;
- public static URI isAnnotationOf;
- public static URI isDerivativeOf;
- public static URI isNextInSequence;
- public static URI isRelatedTo;
- public static URI isRepresentationOf;
- public static URI isSimilarTo;
- public static URI isSuccessorOf;
- public static URI landingPage;
- public static URI occurredAt;
- public static URI realizes;
- public static URI wasPresentAt;
-
- static public URI isShownBy;
- static public URI isShownAt;
- static public URI object;
- public static URI rights;
-
- static{
-
- f = ValueFactoryImpl.getInstance();
-
- edm = "http://www.europeana.eu/schemas/edm/";
-
- Agent = f.createURI(edm + "Agent");
- EuropeanaAggregation = f.createURI(edm + "EuropeanaAggregation");
- EuropeanaObject = f.createURI(edm + "EuropeanaObject");
- Event = f.createURI(edm + "Event");
- InformationResource = f.createURI(edm + "InformationResource");
- NonInformationResource = f.createURI(edm + "NonInformationResource");
- PhysicalThing = f.createURI(edm + "PhysicalThing");
- Place = f.createURI(edm + "Place");
- ProvidedCHO = f.createURI(edm + "ProvidedCHO");
- TimeSpan = f.createURI(edm + "TimeSpan");
- WebResource = f.createURI(edm + "WebResource");
-
-
- aggregatedCHO = f.createURI(edm + "aggregatedCHO");
- currentLocation = f.createURI(edm + "currentLocation");
- happenedAt = f.createURI(edm + "happenedAt");
- hasMet = f.createURI(edm + "hasMet");
- hasType = f.createURI(edm + "hasType");
- hasView = f.createURI(edm + "hasView");
- incorporates = f.createURI(edm + "incorporates");
- isAnnotationOf = f.createURI(edm + "isAnnotationOf");
- isDerivativeOf = f.createURI(edm + "isDerivativeOf");
- isNextInSequence = f.createURI(edm + "isNextInSequence");
- isRelatedTo = f.createURI(edm + "isRelatedTo");
- isRepresentationOf = f.createURI(edm + "isRepresentationOf");
- isSimilarTo = f.createURI(edm + "isSimilarTo");
- isSuccessorOf = f.createURI(edm + "isSuccessorOf");
- landingPage = f.createURI(edm + "landingPage");
- occurredAt = f.createURI(edm + "occurredAt");
- realizes = f.createURI(edm + "realizes");
- wasPresentAt = f.createURI(edm + "wasPresentAt");
-
- isShownBy = f.createURI(edm + "isShownBy");
- isShownAt = f.createURI(edm + "isShownAt");
- object = f.createURI(edm + "object");
- rights = f.createURI(edm + "rights");
- }
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/echo/jsp/ECHOViewer.java
--- a/src/main/java/de/mpiwg/itgroup/echo/jsp/ECHOViewer.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-package de.mpiwg.itgroup.echo.jsp;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class ECHOViewer {
-
-
- private static String SCALER_WS = "http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn=permanent/library/WWKYPR05/pageimg"; //&dw=1639&dh=376
-
- private static String PAGES_WS = "http://digilib.mpiwg-berlin.mpg.de/digitallibrary/dirInfo-xml.jsp?fn=/permanent/library/UR271U6Y/pageimg";
-
- private String currentId = "BVED1RUM";
- private int pageSize;
- private int currentPage;
-
- private static List scanList;
-
- static{
- String[] scansList0 = {
- "BVED1RUM",
- "M9XBU92T",
- "RNEZE8Z6",
- "2BPAV5AP",
- "7T85HQNS",
- "TRQNNGSR",
- "S1C20QWU",
- "8XWYTZ26",
- "6UZB2ZF0",
- "M0XAYXH0",
- "2EBGM67W",
- "NXDAZZYU",
- "MWG2QDZ9",
- "B47T3HY2",
- "FM05UE82",
- "UGTHY0RG",
- "4UZFR41E",
- "2AG56K0B",
- "1T0Z5TU5",
- "QQVPRVXX",
- "RUK8AFQP",
- "ERZHST5Y",
- "5MB6HBYV",
- "5AN0VGK8",
- "0SWBP6BQ",
- "CC2KDXXX",
- "YB4U050C",
- "WTC2BK80",
- "KNA1AZYB",
- "1M75N53E",
- "WRQEXG1A",
- "409E3DCG",
- "XQH10RER",
- "DX904FN7",
- "GEWZ52P2",
- "U6BC9X7F",
- "VREYNH8W",
- "QW00YZFR",
- "4ZPFQTN0",
- "6631A2R6"
- };
- scanList = Arrays.asList(scansList0);
- }
-
-
-
-
- public int getPageSize() {
- return pageSize;
- }
-
- public void setPageSize(int pageSize) {
- this.pageSize = pageSize;
- }
-
- public int getCurrentPage() {
- return currentPage;
- }
-
- public void setCurrentPage(int currentPage) {
- this.currentPage = currentPage;
- }
-}
-
-
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractBean.java
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractBean.java Tue Nov 15 12:36:06 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractBean.java Thu Dec 08 16:05:18 2016 +0100
@@ -62,7 +62,7 @@
}
public void addGeneralMsg(String msg){
- System.out.println(msg);
+ //System.out.println(msg);
this.getSessionBean().addGeneralMsg(msg);
}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java Tue Nov 15 12:36:06 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/SessionBean.java Thu Dec 08 16:05:18 2016 +0100
@@ -16,7 +16,6 @@
import org.mpi.openmind.repository.bo.Entity;
import org.mpi.openmind.security.SecurityService;
import org.mpi.openmind.security.bo.User;
-import org.mpiwg.itgroup.geonames.GeonameForm;
import org.richfaces.event.ItemChangeEvent;
import de.mpiwg.itgroup.ismi.admin.AdminBean;
@@ -48,7 +47,6 @@
private CopyEvent copyEventForm = new CopyEvent();
private TransferEvent transferEventForm = new TransferEvent();
private transient AdvancedSearchBean advancedSearch = new AdvancedSearchBean();
- private GeonameForm geoForm = new GeonameForm();
private EntityDetailsBean entDetailsForm = new EntityDetailsBean();
@@ -400,20 +398,6 @@
}
}
- /*
- public void setPlaceInGeoForm(String id){
- try {
- Long placeId = new Long(id);
- Entity place = getWrapper().getEntityById(placeId);
- if(place != null){
- this.geoForm.loadPlace(place);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }*/
-
-
public void editEntity(Entity entity) {
logger.info("[" + this.getUsername() + "] Edit Entity= " + entity);
@@ -706,11 +690,6 @@
return "";
}
- public String toGeoForm(){
- this.geoForm.loadPlaces(null);
- return PAGE_GEO_FORM;
- }
-
public String displayByAttribute() {
Attribute att = (Attribute) getRequestBean("attribute");
logger.info(att);
@@ -1064,10 +1043,6 @@
this.entDetailsForm = entDetailsForm;
}
- public GeonameForm getGeoForm() {
- return geoForm;
- }
-
public String getSelectedTab() {
return selectedTab;
}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/de/mpiwg/itgroup/ismi/jsf/PhaseTracker.java
--- a/src/main/java/de/mpiwg/itgroup/ismi/jsf/PhaseTracker.java Tue Nov 15 12:36:06 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/jsf/PhaseTracker.java Thu Dec 08 16:05:18 2016 +0100
@@ -97,13 +97,7 @@
getSessionBean(event.getFacesContext()).getPublicCodexView().load(entId);
}
- }/* else if(servletPath.equals("/entry/geonameForm.xhtml")){
}
- String placeId = parameters.get("placeId");
- if(StringUtils.isNotEmpty(placeId)){
- getSessionBean(event.getFacesContext()).setPlaceInGeoForm(placeId);
- }
- }*/
}
}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/org/mpiwg/itgroup/geonames/GeonameForm.java
--- a/src/main/java/org/mpiwg/itgroup/geonames/GeonameForm.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-package org.mpiwg.itgroup.geonames;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.event.ActionEvent;
-
-import org.apache.commons.lang.StringUtils;
-import org.json.JSONObject;
-import org.mpi.openmind.repository.bo.Attribute;
-import org.mpi.openmind.repository.bo.Entity;
-import org.mpi.openmind.repository.utils.NormalizerUtils;
-import org.mpiwg.itgroup.geonames.bo.Geoname;
-
-import de.mpiwg.itgroup.ismi.entry.beans.AbstractBean;
-
-public class GeonameForm extends AbstractBean{
-
- private static String GEONAME_ID = "geoname_id";
-
-
- private String searchPlaceTerm;
- private List places;
- private Entity selectedPlace;
-
- private String searchGeoTerm;
- private List geonames;
- private Geoname selectedGeoname;
- private JSONObject selectedJSONGeoname;
-
- private boolean showGeonamePopup = false;
-
- public void listenerSelectPlace(ActionEvent event){
- Entity place = (Entity)getRequestBean("place");
- if(place != null){
- this.redirect(null, "?placeId=" + place.getId());
- loadPlace(place);
- }
- }
-
- public void loadPlace(Entity place){
- this.selectedPlace = place;
- if(place != null){
- this.searchGeoTerm = this.selectedPlace.getOwnValue();
- this.searchGeonames(selectedPlace.getOwnValue());
- }
- }
-
- public void listenerLoadAllPlaces(ActionEvent event){
- this.loadPlaces(null);
- }
-
- public void listenerSearchPlaces(ActionEvent event){
- this.loadPlaces(this.searchPlaceTerm);
- }
- /*
- public void listenerOpenPopup(ActionEvent event){
- this.selectedPlace = (Entity)getRequestBean("place");
- this.searchGeonames(selectedPlace.getOwnValue());
- this.showGeonamePopup = true;
- }*/
-
- public void listenerCloseSearchPopup(ActionEvent event){
- this.closeSearchPopup();
- }
-
- public void listenerSearchGeonames(ActionEvent event){
- this.searchGeonames(this.searchGeoTerm);
- }
-
- public String actionDisplayGeonameMap(){
- this.selectedGeoname = (Geoname)getRequestBean("geoname");
- if(selectedGeoname != null){
- try {
- this.selectedJSONGeoname = GeonameUtils.getJSONGeoname(selectedGeoname.getId());
- } catch (Exception e) {
- addErrorMsg(e.getMessage());
- e.printStackTrace();
- }
- }
- return "geo_map";
- }
-
- public void loadPlaces(String term){
-
- String nTerm = NormalizerUtils.normalize(term);
-
- System.out.println("Loading place in GeonameForm");
- List list = getAppBean().getWrapper().getEntitiesByDef("PLACE");
- this.places = new ArrayList();
- for(Entity pl : list){
- Attribute att = getAppBean().getWrapper().getAttributeByName(pl.getId(), GEONAME_ID);
- if(att == null || StringUtils.isEmpty(att.getValue())){
- if(StringUtils.isEmpty(nTerm)){
- this.places.add(pl);
- }else if(pl.getNormalizedOwnValue().contains(nTerm)){
- this.places.add(pl);
- }
- }
- }
- }
-
- private void searchGeonames(String term){
-
- try {
- this.searchGeoTerm = term;
- this.geonames = GeonameUtils.search(searchGeoTerm);
- } catch (Exception e) {
- addErrorMsg(e.getMessage());
- e.printStackTrace();
- }
- }
-
- public void listenerAssignGeoname2Place(ActionEvent event){
-
- this.selectedGeoname = (Geoname)getRequestBean("geoname");
-
- if(this.selectedGeoname != null){
- try {
- if(selectedPlace.isLightweight()){
- this.selectedPlace = getAppBean().getWrapper().getEntityContent(selectedPlace);
- }
-
- if(this.selectedPlace.containsAttribute(GEONAME_ID)){
- this.selectedPlace.getAttributeByName(GEONAME_ID).setValue(this.selectedGeoname.getId().toString());
- }else{
- this.selectedPlace.addAttribute(new Attribute(GEONAME_ID, "geoname-id", this.selectedGeoname.getId().toString()));
- }
-
- getAppBean().getWrapper().saveEntity(this.selectedPlace, getSessionBean().getUsername());
-
- addGeneralMsg("The geoname " + selectedGeoname.getId() + " has been assigned successfully to the place " +
- selectedPlace.getOwnValue() + " [ID=" +selectedPlace.getId() + "]");
-
- this.loadPlaces(null);
- this.closeSearchPopup();
- } catch (Exception e) {
- addErrorMsg(e.getMessage());
- e.printStackTrace();
- }
- }else{
- System.err.println("AHHHHH");
- }
- }
-
- private void closeSearchPopup(){
- this.showGeonamePopup = false;
- this.searchGeoTerm = null;
- this.geonames = null;
- this.selectedPlace = null;
- this.redirect(null, "");
-
- }
-
- public String getSearchGeoTerm() {
- return searchGeoTerm;
- }
-
- public void setSearchGeoTerm(String searchGeoTerm) {
- this.searchGeoTerm = searchGeoTerm;
- }
-
- public List getPlaces() {
- return places;
- }
-
- public void setPlaces(List places) {
- this.places = places;
- }
-
- public Entity getSelectedPlace() {
- return selectedPlace;
- }
-
- public void setSelectedPlace(Entity selectedPlace) {
- this.selectedPlace = selectedPlace;
- }
-
- public int getGeonamesSize(){
- if(geonames == null)
- return 0;
- return geonames.size();
- }
-
- public List getGeonames() {
- return geonames;
- }
-
- public void setGeonames(List geonames) {
- this.geonames = geonames;
- }
-
- public Geoname getSelectedGeoname() {
- return selectedGeoname;
- }
-
- public void setSelectedGeoname(Geoname selectedGeoname) {
- this.selectedGeoname = selectedGeoname;
- }
-
- public boolean isShowGeonamePopup() {
- return showGeonamePopup;
- }
-
- public void setShowGeonamePopup(boolean showGeonamePopup) {
- this.showGeonamePopup = showGeonamePopup;
- }
-
- public JSONObject getSelectedJSONGeoname() {
- return selectedJSONGeoname;
- }
-
- public void setSelectedJSONGeoname(JSONObject selectedJSONGeoname) {
- this.selectedJSONGeoname = selectedJSONGeoname;
- }
-
- public String getSearchPlaceTerm() {
- return searchPlaceTerm;
- }
-
- public void setSearchPlaceTerm(String searchPlaceTerm) {
- this.searchPlaceTerm = searchPlaceTerm;
- }
-
-}
diff -r 9adcab5143a3 -r e5d4443a1bc5 src/main/java/org/mpiwg/itgroup/geonames/GeonameUtils.java
--- a/src/main/java/org/mpiwg/itgroup/geonames/GeonameUtils.java Tue Nov 15 12:36:06 2016 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-package org.mpiwg.itgroup.geonames;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.mpiwg.itgroup.geonames.bo.Geoname;
-
-public class GeonameUtils {
-
- public static final String GEONAME_SEARCH = "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/geonames/service?method=search&maxRows=1000&mode=json&q=";
- public static final String GEONAME_GET_BY_ID =
- "https://openmind-ismi-dev.mpiwg-berlin.mpg.de/geonames/service?method=getGeoname&mode=json&geonameId=";
- private static final int BUFFER_SIZE = 1024;
-
- public static List search(String term) throws Exception{
- List list = new ArrayList();
-
- JSONObject jsonRS = JSONFromURL(GEONAME_SEARCH + term);
-
- JSONArray jsonGeoList = jsonRS.getJSONArray("geonames");
- for(int i=0; i < jsonGeoList.length(); i++){
- list.add(json2Geoname(jsonGeoList.getJSONObject(i)));
- }
- return list;
- }
-
- public static JSONObject getJSONGeoname(Integer id) throws Exception{
- JSONObject jsonRS = JSONFromURL(GEONAME_GET_BY_ID + id);
-
- JSONArray jsonGeoList = jsonRS.getJSONArray("geonames");
- if(jsonGeoList.length() > 0)
- return jsonGeoList.getJSONObject(0);
- return null;
- }
-
- //gets the JSONObject at the specified URL
- public static JSONObject JSONFromURL(String url) throws Exception {
- trustAll();
- URL realURL = new URL(url);
- BufferedReader reader = read(realURL);
- int charsRead;
- char[] copyBuffer = new char[BUFFER_SIZE];
- StringBuffer sb = new StringBuffer();
- while ((charsRead = reader.read(copyBuffer, 0, BUFFER_SIZE)) != -1)
- sb.append(copyBuffer, 0, charsRead);
- JSONObject result = new JSONObject( sb.toString() );
- return result;
- }
-
- public static Geoname json2Geoname(JSONObject json){
- Geoname geo = new Geoname();
- try {
-
- geo.setId(json.getInt("geonameId"));
-
- if(json.has("lng"))
- geo.setLng(json.getDouble("lng"));
-
- if(json.has("lat"))
- geo.setLat(json.getDouble("lat"));
-
- if(json.has("countryCode"))
- geo.setCountryCode(json.getString("countryCode"));
-
- if(json.has("countryName"))
- geo.setCountryName(json.getString("countryName"));
-
- if(json.has("name"))
- geo.setName(json.getString("name"));
-
- if(json.has("toponymName"))
- geo.setToponymName(json.getString("toponymName"));
-
- if(json.has("population"))
- geo.setPopulation(json.getInt("population"));
-
- if(json.has("alternateNames")){
- JSONArray array = json.getJSONArray("alternateNames");
- for(int i=0; i alternateNames = new ArrayList();
- private String countryName;
- private String toponymName;
- private String name;
- private String countryCode;
- private Double lng;
- private Double lat;
- private Integer population;
-
- private String fCls;
- private String fCode;
- private String clsDescription;
- private String clsName;
-
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
-
- public List getMoreInfo(){
-
- List rs = new ArrayList();
- rs.add("Lat/Lng: " + lat + "/" + lng);
- rs.add("Population: " + population);
- rs.add("Class name: " + clsName);
- /*
- rs.add("Class description: " + clsDescription);
- rs.add("Class name: " + clsName);
- rs.add("Class name: " + clsName);
- rs.add(fCls + ", " + fCode);
- */
- /*
- if(StringUtils.isNotEmpty(countryName)){
- if(sb.length() > 0)
- sb.append(", ");
- sb.append("Country: " + countryName);
- }
- if(StringUtils.isNotEmpty(countryCode)){
- if(sb.length() > 0)
- sb.append(", ");
- sb.append("Country code: " + countryCode);
- }*/
-
- return rs;
- }
-
- public List getSomeAlternateName(){
- List rs = new ArrayList();
-
- if(this.alternateNames.size() > 0){
- int counter = 0;
- Queue queue = new LinkedList(this.alternateNames);
-
- int namesPerLine = 3;
-
- while(!queue.isEmpty() && (namesPerLine * 5) > counter){
-
- if(counter % namesPerLine == 0){
- rs.add(queue.poll());
- }else{
- String name = rs.remove(rs.size() - 1);
- name += ", " + queue.poll();
- rs.add(name);
- }
- counter++;
- }
- }
-
- return rs;
- }
-
- public String getAlternateNamesAsString(){
- StringBuilder sb = new StringBuilder();
- int count = 0;
- for(String s : this.alternateNames){
- if(count > 0){
- sb.append(", ");
- }
- sb.append(s);
- count++;
- }
- return sb.toString();
- }
-
- public List getAlternateNames() {
- return alternateNames;
- }
-
- public void setAlternateNames(List alternateNames) {
- this.alternateNames = alternateNames;
- }
- public String getCountryName() {
- return countryName;
- }
- public void setCountryName(String countryName) {
- this.countryName = countryName;
- }
- public String getToponymName() {
- return toponymName;
- }
- public void setToponymName(String toponymName) {
- this.toponymName = toponymName;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getCountryCode() {
- return countryCode;
- }
- public void setCountryCode(String countryCode) {
- this.countryCode = countryCode;
- }
- public Double getLng() {
- return lng;
- }
- public void setLng(Double lng) {
- this.lng = lng;
- }
- public Double getLat() {
- return lat;
- }
- public void setLat(Double lat) {
- this.lat = lat;
- }
- public Integer getPopulation() {
- return population;
- }
- public void setPopulation(Integer population) {
- this.population = population;
- }
- public String getfCls() {
- return fCls;
- }
- public void setfCls(String fCls) {
- this.fCls = fCls;
- }
-
- public String getfCode() {
- return fCode;
- }
- public void setfCode(String fCode) {
- this.fCode = fCode;
- }
- public String getClsDescription() {
- return clsDescription;
- }
- public void setClsDescription(String clsDescription) {
- this.clsDescription = clsDescription;
- }
- public String getClsName() {
- return clsName;
- }
- public void setClsName(String clsName) {
- this.clsName = clsName;
- }
-}