[Mapbender-commits] r8373 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 7 02:03:25 PDT 2012


Author: armin11
Date: 2012-06-07 02:03:25 -0700 (Thu, 07 Jun 2012)
New Revision: 8373

Modified:
   trunk/mapbender/http/classes/class_iso19139.php
Log:
Add simple initial iso19139 object to class - further work have to be done.

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2012-06-06 18:54:10 UTC (rev 8372)
+++ trunk/mapbender/http/classes/class_iso19139.php	2012-06-07 09:03:25 UTC (rev 8373)
@@ -40,7 +40,27 @@
 	var $type;
 	var $origin;
 
-
+	function __construct() {
+		//initialize empty iso19139 object
+		$this->fileIdentifier = "";
+		$title->title = "empty iso19139 object title";
+		$title->abstract = "empty iso19139 object abstract";
+		$this->createDate = "1900-01-01";
+		$this->changeDate = "1900-01-01";
+		$this->metadata = "";
+		$this->datasetId = "";
+		$this->datasetIdCodeSpace = "";	
+		$this->keywords[0] = "";	
+		$this->hierachyLevel = "dataset";
+		$this->tmpExtentBegin = "1900-01-01";
+		$this->tmpExtentEnd = "1900-01-01";
+		$this->randomId = "";
+		$this->href = "";
+		$this->format = "";
+		$this->type = "";
+		$this->origin = "";
+		$this->refSystem = "";
+	}
 	public function removeGetRecordTag ($xml) {
 		$regex = "#<csw:GetRecordByIdResponse .*?>#";
 		$xml = preg_replace($regex,"",$xml);
@@ -70,10 +90,14 @@
 		//if parsing was successful
 		if ($iso19139Xml != false) {
 			$this->fileIdentifier = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:fileIdentifier/gco:CharacterString');
+			$this->fileIdentifier = $this->fileIdentifier[0];
 			$this->createDate = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:dateStamp/gco:Date');
+			$this->createDate = $this->createDate[0];
 			$this->changeDate = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:dateStamp/gco:Date');
+			$this->changeDate = $this->changeDate[0];
 			//TODO: check if this is set, maybe DateTime must be searched instead?
 			$this->title = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString');
+			$this->title = $this->title[0];
 			//dataset identifier - howto model into md_metadata?
 			//check where datasetid is defined - maybe as RS_Identifier or as MD_Identifier see http://inspire.jrc.ec.europa.eu/documents/Metadata/INSPIRE_MD_IR_and_ISO_v1_2_20100616.pdf page 18
 			//First check if MD_Identifier is set, then check if RS_Identifier is used!
@@ -96,10 +120,14 @@
 			}
 			//abstract
 			$this->abstract = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString');
+			$this->abstract = $this->abstract[0];
 			$this->keywords = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString');
 			$this->hierachyLevel = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:hierarchyLevel/gmd:MD_ScopeCode');
+			$this->hierachyLevel = $this->hierachyLevel[0];
 			$this->tmpExtentBegin = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition');
-			$this->tmpExtentEnd = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition');			
+			$this->tmpExtentBegin = $this->tmpExtentBegin[0];
+			$this->tmpExtentEnd = $iso19139Xml->xpath('/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition');		
+			$this->tmpExtentEnd = $this->tmpExtentEnd[0];
 			//spatial_res_type
 			//spatial_res_value
 			//ref_system
@@ -183,7 +211,7 @@
 					$e = new mb_exception(_mb("Cannot insert metadata relation!"));
 					return false;
 				} else {
-					$sql = "UPDATE mb_metadata SET harvestresult = 0 where metadata_id = $1";
+					$sql = "UPDATE mb_metadata SET harvestresult = 0, harvestexception = 'Linked metadata could not be interpreted, only linkage is stored to mb_metadata!' where metadata_id = $1";
 					$v = array($metadataId);
 					$t = array('i');
 					$res = db_prep_query($sql,$v,$t);
@@ -208,13 +236,13 @@
 			$this->type,
 			$this->fileIdentifier[0],
 			$this->title[0],
-			$this->createDate[0],
-			$this->changeDate[0],
+			$this->createDate,
+			$this->changeDate,
 			$this->abstract[0],
 			$this->keywords[0],
-			$this->hierachyLevel[0],
-			$this->tmpExtentBegin[0],
-			$this->tmpExtentEnd[0],
+			$this->hierachyLevel,
+			$this->tmpExtentBegin,
+			$this->tmpExtentEnd,
 			't',
 			$this->datasetId,
 			$this->datasetIdCodeSpace,



More information about the Mapbender_commits mailing list