[Mapbender-commits] r10153 - in trunk/mapbender: conf http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jun 18 02:07:04 PDT 2019


Author: armin11
Date: 2019-06-18 02:07:04 -0700 (Tue, 18 Jun 2019)
New Revision: 10153

Modified:
   trunk/mapbender/conf/isoMetadata.conf
   trunk/mapbender/http/classes/class_iso19139.php
Log:
First draft to show license url in rdfa

Modified: trunk/mapbender/conf/isoMetadata.conf
===================================================================
--- trunk/mapbender/conf/isoMetadata.conf	2019-06-17 10:06:46 UTC (rev 10152)
+++ trunk/mapbender/conf/isoMetadata.conf	2019-06-18 09:07:04 UTC (rev 10153)
@@ -131,7 +131,7 @@
 //B 2.1 Topic category (9)
 array(	ibus => "t01_object.obj_id",
 	iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode",
-	iso19139explode => "true" ,
+	iso19139explode => "false" ,
 	inspire => "topic category",
 	inspiremandatory => "true",
 	iso_name => "topic category",
@@ -156,7 +156,7 @@
 //B 3.1 keyword value dataset (11)
 array(	ibus => "t01_object.obj_id",
 	iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString",
-	iso19139explode => "true" ,
+	iso19139explode => "false" ,
 	inspire => "keyword value",
 	inspiremandatory => "true",
 	iso_name => "keywordValue",
@@ -173,7 +173,7 @@
 //B 4.1 Geographic bounding box (12)
 array(	ibus => "t01_object.obj_id",
 	iso19139 => "/gmd:MD_Metadata/gmd:identificationInfo/*/*/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/*/gco:Decimal",
-	iso19139explode => "true" ,
+	iso19139explode => "false" ,
 	inspire => "geographic bounding box",
 	inspiremandatory => "true",
 	iso_name => "geographic bounding box",
@@ -666,7 +666,25 @@
 	value => "",
 	category => "actuality",
 	description => _mb("")
+),
+//new for schema org mapping - extract license url as defined in gdi-de standard - json (40)
+array(	ibus => "t01_object.obj_id",
+	iso19139 => '//gmd:MD_Metadata/gmd:identificationInfo//gmd:resourceConstraints/gmd:MD_LegalConstraints[gmd:useConstraints/gmd:MD_RestrictionCode/@codeListValue="otherRestrictions"]/gmd:otherConstraints/gco:CharacterString',
+	iso19139explode => "true" ,
+	inspire => "license url has no inspire equivalent",
+	inspiremandatory => "false",
+	iso_name => "license url has no iso equivalent",
+	html => _mb("License URL"),
+	value => "",
+	category => "useconstraints",
+	description => _mb("License URL from GDI-DE metadata standard"),
+	//rdf-a
+	schemaorg_typeof => 'URL', //use pathes for hierachy - example
+	schemaorg_property => 'license', //TODO 
+	schemaorg_processor => 'licenseJson',
+	rdfa_content => null //fix content/value,
 )
+
 /*
 <gmd:extent><gmd:EX_Extent><gmd:temporalElement><gmd:EX_TemporalExtent><gmd:extent><gml:TimePeriod gml:id="temporalextent"><gml:beginPosition>2010-03-10</gml:beginPosition><gml:endPosition>2011-05-25</gml:endPosition></gml:TimePeriod></gmd:extent></gmd:EX_TemporalExtent></gmd:temporalElement></gmd:EX_Extent></gmd:extent>
 */

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2019-06-17 10:06:46 UTC (rev 10152)
+++ trunk/mapbender/http/classes/class_iso19139.php	2019-06-18 09:07:04 UTC (rev 10153)
@@ -772,11 +772,16 @@
 			$iso19139Xml->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
 			include(dirname(__FILE__)."/../../conf/isoMetadata.conf");
 			for($a = 0; $a < count($iso19139Hash); $a++) {
-				$resultOfXpath = $iso19139Xml->xpath("/".$iso19139Hash[$a]['iso19139']);
-				for ($i = 0; $i < count($resultOfXpath); $i++) {
-					$iso19139Hash[$a]['value'] = $iso19139Hash[$a]['value'].",".$resultOfXpath[$i];
+				$resultOfXpath = $iso19139Xml->xpath("/".$iso19139Hash[$a]['iso19139']);#
+				//if array should not be handled as array - handle it as string!
+				if ($iso19139Hash[$a]['iso19139explode'] != "true") {
+					for ($i = 0; $i < count($resultOfXpath); $i++) {
+						$iso19139Hash[$a]['value'] = $iso19139Hash[$a]['value'].",".$resultOfXpath[$i];
+					}
+					$iso19139Hash[$a]['value'] = ltrim($iso19139Hash[$a]['value'],',');
+				} else {
+					$iso19139Hash[$a]['value'] = $resultOfXpath;
 				}
-				$iso19139Hash[$a]['value'] = ltrim($iso19139Hash[$a]['value'],',');
 			}
 			//generate html
 			$html = '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dctype="http://purl.org/dc/dcmitype/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xml:lang="'.$languageCode.'">';
@@ -1079,7 +1084,7 @@
 			$html .= '</fieldset>';
 			$html .= '<fieldset><legend>'._mb("Access constraints").'</legend>';
 			$html .= $tableBegin;
-			$hashIndices = array(24, 25);
+			$hashIndices = array(24, 25, 40);
 			foreach ($hashIndices as $index) {
 				$html .= $this->getHtmlRow($t_a, $t_b, $t_c, $iso19139Hash, $index);
 			}
@@ -1209,6 +1214,27 @@
 					$bboxArray = explode(",", $iso19139Hash[$isoHashIndex]['value']);
 					$iso19139Hash[$isoHashIndex]['value'] = $bboxArray[0]." ".$bboxArray[2]." ".$bboxArray[1]." ".$bboxArray[3];
 					break;
+				case "licenseJson":
+					//test and parse json from array 
+					$otherConstraints = $iso19139Hash[$isoHashIndex]['value'];
+					$licenseFound = false;
+					foreach($otherConstraints as $otherConstraint) {
+						if ($licenseFound == false) {
+							if (json_decode(stripslashes($otherConstraint)) != NULL) {
+								$licenseFound = true;
+								//parse json
+								$standardizedLicense = json_decode(stripslashes($otherConstraint));
+								//Look for source
+								$URL = $standardizedLicense->url;
+								//$this->licenseJson = stripslashes($otherConstraint);
+								//$e = new mb_exception("class_iso19139.php: licenseSourceNote: ".$this->licenseSourceNote);
+							} else {
+								$URL = "No license url found or json not valid!";
+							}
+						}
+					} 
+					$iso19139Hash[$isoHashIndex]['value'] = $URL;
+					break;
 				default:
 					break;	
 			}
@@ -1223,6 +1249,9 @@
 		}
 		if (isset($iso19139Hash[$isoHashIndex]['schemaorg_typeof'])) {
 			$stringToReturn .= ' typeof="'.$iso19139Hash[$isoHashIndex]['schemaorg_typeof'].'"';
+			if ($iso19139Hash[$isoHashIndex]['schemaorg_typeof'] == "URL") {
+				$stringToReturn .= ' href="'.$iso19139Hash[$isoHashIndex]['value'].'"';
+			}
 		}
 		/*if (isset($iso19139Hash[$isoHashIndex]['content'])) {
 			$stringToReturn .= ' content="'.$iso19139Hash[$isoHashIndex]['content'].'"';



More information about the Mapbender_commits mailing list