-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Harvester / Simple URL / ODS improvement
* Ignore "null" value * Add support for "metas/dcat" * Fix path for language when using v2 API * Add spatial and temporal extent when available * Add extra keywords based one "metas/dcat/temporal" and "metas/default/territory" * Add resource identifier * Add record count and geometry type * Add lineage and credit * Add references * Cleanup namespaces Follow up of #7201 Related to #8359
- Loading branch information
1 parent
c7f8e8b
commit 87a8e3d
Showing
9 changed files
with
2,155 additions
and
553 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...3.2018/src/main/java/org/fao/geonet/schema/iso19115_3_2018/ISO19115_3_2018Namespaces.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/* | ||
* Copyright (C) 2001-2024 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
package org.fao.geonet.schema.iso19115_3_2018; | ||
|
||
import org.jdom.Namespace; | ||
|
2 changes: 1 addition & 1 deletion
2
...2018/src/main/java/org/fao/geonet/schema/iso19115_3_2018/ISO19115_3_2018SchemaPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,323 changes: 774 additions & 549 deletions
1,323
schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/fromJsonOpenDataSoft.xsl
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/* | ||
* Copyright (C) 2001-2024 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
package org.fao.geonet.schema; | ||
|
||
import org.fao.geonet.schema.iso19115_3_2018.ISO19115_3_2018SchemaPlugin; | ||
|
@@ -14,9 +36,6 @@ | |
import static org.junit.Assert.assertThat; | ||
import static org.xmlunit.matchers.EvaluateXPathMatcher.hasXPath; | ||
|
||
/** | ||
* Created by francois on 3/24/14. | ||
*/ | ||
public class LanguageXslProcessTest extends XslProcessTest { | ||
|
||
public LanguageXslProcessTest() { | ||
|
75 changes: 75 additions & 0 deletions
75
schemas/iso19115-3.2018/src/test/java/org/fao/geonet/schema/XslConversionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (C) 2001-2024 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
package org.fao.geonet.schema; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import org.fao.geonet.schema.iso19115_3_2018.ISO19115_3_2018SchemaPlugin; | ||
import org.fao.geonet.schemas.XslProcessTest; | ||
import org.fao.geonet.utils.Xml; | ||
import org.jdom.Element; | ||
import static org.junit.Assert.assertFalse; | ||
import org.junit.Test; | ||
import org.xmlunit.builder.DiffBuilder; | ||
import org.xmlunit.builder.Input; | ||
import org.xmlunit.diff.DefaultNodeMatcher; | ||
import org.xmlunit.diff.Diff; | ||
import org.xmlunit.diff.ElementSelectors; | ||
|
||
public class XslConversionTest extends XslProcessTest { | ||
|
||
public XslConversionTest() { | ||
super(); | ||
this.setNs(ISO19115_3_2018SchemaPlugin.allNamespaces); | ||
} | ||
|
||
@Test | ||
public void testOdsConversion() throws Exception { | ||
xslFile = Paths.get(testClass.getClassLoader().getResource("convert/fromJsonOpenDataSoft.xsl").toURI()); | ||
xmlFile = Paths.get(testClass.getClassLoader().getResource("ods.xml").toURI()); | ||
Path jsonFile = Paths.get(testClass.getClassLoader().getResource("ods.json").toURI()); | ||
String jsonString = Files.readString(jsonFile); | ||
Element xmlFromJSON = Xml.getXmlFromJSON(jsonString); | ||
xmlFromJSON.setName("record"); | ||
xmlFromJSON.addContent(new Element("nodeUrl").setText("https://www.odwb.be")); | ||
|
||
Element inputElement = Xml.loadFile(xmlFile); | ||
String expectedXml = Xml.getString(inputElement); | ||
|
||
Element resultElement = Xml.transform(xmlFromJSON, xslFile); | ||
String resultOfConversion = Xml.getString(resultElement); | ||
|
||
Diff diff = DiffBuilder | ||
.compare(Input.fromString(resultOfConversion)) | ||
.withTest(Input.fromString(expectedXml)) | ||
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) | ||
.normalizeWhitespace() | ||
.ignoreComments() | ||
.checkForSimilar() | ||
.build(); | ||
assertFalse( | ||
String.format("Differences: %s", diff.toString()), | ||
diff.hasDifferences()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
schemas/iso19115-3.2018/src/test/java/org/fao/geonet/util/XslUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
/* | ||
* Copyright (C) 2001-2024 Food and Agriculture Organization of the | ||
* United Nations (FAO-UN), United Nations World Food Programme (WFP) | ||
* and United Nations Environment Programme (UNEP) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
* | ||
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2, | ||
* Rome - Italy. email: [email protected] | ||
*/ | ||
package org.fao.geonet.util; | ||
|
||
public class XslUtil { | ||
public static String twoCharLangCode(String iso3code) { | ||
return iso3code.substring(0, 2); | ||
} | ||
public static String threeCharLangCode(String iso2code) { | ||
return "fre"; | ||
} | ||
} |
Oops, something went wrong.