Revision 46817
Added by Alessia Bardi about 7 years ago
modules/dnet-msro-service/branches/saxonHE/src/test/java/eu/dnetlib/msro/workflows/nodes/transform/X3MTransformJobNodeTest.java | ||
---|---|---|
1 |
package eu.dnetlib.msro.workflows.nodes.transform; |
|
2 |
|
|
3 |
import java.time.Duration; |
|
4 |
import java.time.LocalDateTime; |
|
5 |
|
|
6 |
import org.junit.Test; |
|
7 |
|
|
8 |
/** |
|
9 |
* Created by Alessia Bardi on 13/04/2017. |
|
10 |
* |
|
11 |
* @author Alessia Bardi |
|
12 |
*/ |
|
13 |
public class X3MTransformJobNodeTest { |
|
14 |
|
|
15 |
private X3MTransformJobNode transformJob = new X3MTransformJobNode(); |
|
16 |
private String header = "<oai:header xmlns:dri=\"http://www.driver-repository.eu/namespace/dri\">\n" |
|
17 |
+ " <dri:objIdentifier>ariadne_mock::0000023f507999464aa2b78875b7e5d6</dri:objIdentifier>\n" |
|
18 |
+ " <dri:recordIdentifier>2420500</dri:recordIdentifier>\n" |
|
19 |
+ " <dri:dateOfCollection>2017-04-10T18:44:46.85+02:00</dri:dateOfCollection>\n" |
|
20 |
+ " <dri:datasourceprefix>ariadne_mock</dri:datasourceprefix>\n" |
|
21 |
+ " <dri:datasourcename>Ariadne Mock</dri:datasourcename>\n" |
|
22 |
+ " <dri:dateOfTransformation>2017-04-12T16:31:45.766</dri:dateOfTransformation>\n" |
|
23 |
+ " <dri:invalid value=\"true\">\n" |
|
24 |
+ " <dri:error vocabularies=\"dnet:languages\" xpath=\"//*[local-name()='P72_has_language']\"\n" |
|
25 |
+ " term=\"en\"/>\n" |
|
26 |
+ " </dri:invalid>\n" |
|
27 |
+ " </oai:header>"; |
|
28 |
private String footer = "<oai:about xmlns:dri=\"http://www.driver-repository.eu/namespace/dri\">\n" |
|
29 |
+ " <provenance xmlns=\"http://www.openarchives.org/OAI/2.0/provenance\"\n" |
|
30 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" |
|
31 |
+ " xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/provenance http://www.openarchives.org/OAI/2.0/provenance.xsd\">\n" |
|
32 |
+ " <originDescription xmlns=\"\" altered=\"true\" harvestDate=\"2017-04-10T18:44:46.85+02:00\">\n" |
|
33 |
+ " <baseURL>sftp%3A%2F%2Fariadne2.isti.cnr.it%2F..%2F..%2Fdata%2Ftransform%2Facdm_correct</baseURL>\n" |
|
34 |
+ " <identifier/>\n" |
|
35 |
+ " <datestamp/>\n" |
|
36 |
+ " <metadataNamespace/>\n" |
|
37 |
+ " </originDescription>\n" |
|
38 |
+ " </provenance>\n" |
|
39 |
+ " </oai:about>"; |
|
40 |
private String metadata=" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" |
|
41 |
+ " xmlns:dbpedia-owl=\"http://dbpedia.org/ontology/\"\n" |
|
42 |
+ " xmlns:acdm=\"http://registry.ariadne-infrastructure.eu/\"\n" |
|
43 |
+ " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"\n" |
|
44 |
+ " xmlns:skos=\"http://www.w3.org/2004/02/skos/core#\"\n" |
|
45 |
+ " xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n" |
|
46 |
+ " xmlns:frbr=\"http://www.cidoc-crm.org/frbroo/\" xmlns:dcterms=\"http://purl.org/dc/terms/\"\n" |
|
47 |
+ " xmlns:dcat=\"http://www.w3.org/ns/dcat#\" xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"\n" |
|
48 |
+ " xmlns:crm=\"http://www.cidoc-crm.org/cidoc-crm/\"\n" |
|
49 |
+ " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" |
|
50 |
+ " <frbr:F30_Publication_Event rdf:about=\"uuid:AAAA\"/>\n" |
|
51 |
+ " <crm:E65_Creation rdf:about=\"uuid:AAAB\"/>\n" |
|
52 |
+ " <crm:E73_Information_Object\n" |
|
53 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/dataset/2420500\">\n" |
|
54 |
+ " <crm:P129_is_about>\n" |
|
55 |
+ " <crm:E73_Information_Object\n" |
|
56 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/subject/CAIRN\">\n" |
|
57 |
+ " <crm:P129_is_about>CAIRN</crm:P129_is_about>\n" |
|
58 |
+ " </crm:E73_Information_Object>\n" |
|
59 |
+ " </crm:P129_is_about>\n" |
|
60 |
+ " <crm:P129_is_about>\n" |
|
61 |
+ " <crm:E73_Information_Object\n" |
|
62 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/subject/HUT%20CIRCLE\">\n" |
|
63 |
+ " <crm:P129_is_about>HUT CIRCLE</crm:P129_is_about>\n" |
|
64 |
+ " </crm:E73_Information_Object>\n" |
|
65 |
+ " </crm:P129_is_about>\n" |
|
66 |
+ " <crm:P104_is_subject_to>ADS Terms and Conditions</crm:P104_is_subject_to>\n" |
|
67 |
+ " <crm:P129_is_about>\n" |
|
68 |
+ " <crm:E73_Information_Object\n" |
|
69 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/subject/SHEEPFOLD\">\n" |
|
70 |
+ " <crm:P129_is_about>SHEEPFOLD</crm:P129_is_about>\n" |
|
71 |
+ " </crm:E73_Information_Object>\n" |
|
72 |
+ " </crm:P129_is_about>\n" |
|
73 |
+ " <crm:P129_is_about>\n" |
|
74 |
+ " <crm:E73_Information_Object\n" |
|
75 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/subject/FIELD%20SYSTEM\">\n" |
|
76 |
+ " <crm:P129_is_about>FIELD SYSTEM</crm:P129_is_about>\n" |
|
77 |
+ " </crm:E73_Information_Object>\n" |
|
78 |
+ " </crm:P129_is_about>\n" |
|
79 |
+ " <crm:P102_has_title>MID GLEN CROE</crm:P102_has_title>\n" |
|
80 |
+ " <crm:P165_incorporates>\n" |
|
81 |
+ " <crm:E33_Linguistic_Object rdf:about=\"uuid:AAAG\">\n" |
|
82 |
+ " <crm:P72_has_language>en</crm:P72_has_language>\n" |
|
83 |
+ " </crm:E33_Linguistic_Object>\n" |
|
84 |
+ " </crm:P165_incorporates>\n" |
|
85 |
+ " <crm:P67_refers_to>\n" |
|
86 |
+ " <crm:E1_CRM_Entity rdf:about=\"uuid:AAAH\">\n" |
|
87 |
+ " <crm:P2_has_type>Sites and monuments databases or\n" |
|
88 |
+ " inventories</crm:P2_has_type>\n" |
|
89 |
+ " </crm:E1_CRM_Entity>\n" |
|
90 |
+ " </crm:P67_refers_to>\n" |
|
91 |
+ " <crm:P93i_was_taken_out_of_existence_by>\n" |
|
92 |
+ " <crm:E6_Destruction rdf:about=\"uuid:AAAE\">\n" |
|
93 |
+ " <crm:P4_has_time-span>\n" |
|
94 |
+ " <crm:E52_Time-Span rdf:about=\"uuid:AAAF\">\n" |
|
95 |
+ " <crm:P81_ongoing_throughout>2013-12-09\n" |
|
96 |
+ " 00:00:00.0</crm:P81_ongoing_throughout>\n" |
|
97 |
+ " </crm:E52_Time-Span>\n" |
|
98 |
+ " </crm:P4_has_time-span>\n" |
|
99 |
+ " </crm:E6_Destruction>\n" |
|
100 |
+ " </crm:P93i_was_taken_out_of_existence_by>\n" |
|
101 |
+ " <crm:P94i_was_created_by>\n" |
|
102 |
+ " <frbr:F30_Publication_Event rdf:about=\"uuid:AAAC\">\n" |
|
103 |
+ " <crm:P4_has_time-span>\n" |
|
104 |
+ " <crm:E52_Time-Span rdf:about=\"uuid:AAAD\">\n" |
|
105 |
+ " <crm:P81_ongoing_throughout>2013-12-09\n" |
|
106 |
+ " 00:00:00.0</crm:P81_ongoing_throughout>\n" |
|
107 |
+ " </crm:E52_Time-Span>\n" |
|
108 |
+ " </crm:P4_has_time-span>\n" |
|
109 |
+ " </frbr:F30_Publication_Event>\n" |
|
110 |
+ " </crm:P94i_was_created_by>\n" |
|
111 |
+ " <crm:P129_is_about>\n" |
|
112 |
+ " <crm:E73_Information_Object\n" |
|
113 |
+ " rdf:about=\"http://registry.ariadne-infrastructure.eu/subject/BUILDING\">\n" |
|
114 |
+ " <crm:P129_is_about>BUILDING</crm:P129_is_about>\n" |
|
115 |
+ " </crm:E73_Information_Object>\n" |
|
116 |
+ " </crm:P129_is_about>\n" |
|
117 |
+ " <crm:P1_is_identified_by>2420500</crm:P1_is_identified_by>\n" |
|
118 |
+ " <crm:P106i_forms_part_of>http://registry.ariadne-infrastructure.eu/collection/22721290</crm:P106i_forms_part_of>\n" |
|
119 |
+ " <crm:P3_has_note>Multiple instances of: SHEEPFOLD<br /><br />Multiple\n" |
|
120 |
+ " instances of: BUILDING<br />Multiple instances of: FIELD SYSTEM<br\n" |
|
121 |
+ " />Possible instance of: CAIRN<br />Multiple instances of: HUT\n" |
|
122 |
+ " CIRCLE<br />Possible instance of: HUT CIRCLE</crm:P3_has_note>\n" |
|
123 |
+ " </crm:E73_Information_Object>\n" |
|
124 |
+ " </rdf:RDF>"; |
|
125 |
|
|
126 |
@Test |
|
127 |
public void testBuildXML(){ |
|
128 |
LocalDateTime now = LocalDateTime.now(); |
|
129 |
String res = transformJob.buildXML(header, now.toString(), metadata, footer); |
|
130 |
LocalDateTime end = LocalDateTime.now(); |
|
131 |
System.out.println("Building XML took:"+Duration.between(now, end).toMillis()); |
|
132 |
} |
|
133 |
} |
Also available in: Unified diff
Test