[Mapbender-commits] r9641 - in trunk/mapbender/http: classes plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 9 07:21:04 PST 2017
Author: armin11
Date: 2017-01-09 07:21:04 -0800 (Mon, 09 Jan 2017)
New Revision: 9641
Modified:
trunk/mapbender/http/classes/class_iso19139.php
trunk/mapbender/http/plugins/mb_metadata_addon.php
trunk/mapbender/http/plugins/mb_metadata_server.php
Log:
New possibility to declare a simple inspire data conformancy - todo: howto parse external metadata from regulation info
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2017-01-09 13:28:02 UTC (rev 9640)
+++ trunk/mapbender/http/classes/class_iso19139.php 2017-01-09 15:21:04 UTC (rev 9641)
@@ -16,6 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../../conf/isoMetadata.conf");
require_once(dirname(__FILE__)."/class_connector.php");
require_once(dirname(__FILE__)."/class_Uuid.php");
require_once(dirname(__FILE__) . "/class_propagateMetadata.php");
@@ -56,6 +57,7 @@
var $harvestException;
var $lineage;
var $inspireTopConsistence; //db bool, 't' or 'f'
+ var $inspireInteroperability; //db bool, 't' or 'f' - declaration if the provided data should be compliant with the interoperablity implementing rule
var $spatialResType;
var $spatialResValue;
var $export2Csw; //db bool, 't' or 'f'
@@ -79,6 +81,7 @@
var $fileIdentifierAlreadyInDB; //bool
var $resourceResponsibleParty; //char
var $resourceContactEmail; //char
+ var $codeListUpdateFrequencyArray;
function __construct() {
//initialize empty iso19139 object
@@ -116,6 +119,7 @@
$this->harvestException = "";
$this->lineage = "";
$this->inspireTopConsistence = "f";
+ $this->inspireInteroperability = "f";
$this->spatialResType = "";
$this->spatialResValue = "";
$this->export2Csw = "t";
@@ -137,6 +141,11 @@
$this->resourceResponsibleParty = null;
$this->resourceContactEmail = null;
$this->previewImage = null;
+ $this->codeListUpdateFrequencyArray = $codeListUpdateFrequencyArray;
+ //read inspire legislation info from json file
+ //$e = new mb_exception(__FILE__ ."/../../conf/inspire_legislation.json");
+ //$this->inspireLegislation = json_decode(file_get_contents(__FILE__ ."/../../../conf/inspire_legislation.json"), true);
+ //$e = new mb_exception(json_encode($this->inspireLegislation));
}
public function removeGetRecordTag ($xml) {
@@ -407,6 +416,11 @@
$this->lineage = $this->lineage[0];
//inspire_charset
//inspire_top_consistence
+ //inspire_interoperability
+ //$e = new mb_exception(json_encode($this->inspireLegislation));
+ //$e = new mb_exception($this->inspireLegislation[0]->label->de);
+ //if dataset and ir is defined in the conformance declaration!
+
//responsible_party
//fees
//"constraints"
@@ -447,6 +461,16 @@
$this->resourceResponsibleParty = $this->resourceResponsibleParty[0];
$this->resourceContactEmail = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString');
$this->resourceContactEmail = $this->resourceContactEmail[0];
+ //parse extension for gmd:resourceMaintenance
+
+ $updateFrequency = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceMaintenance/gmd:MD_MaintenanceInformation/gmd:maintenanceAndUpdateFrequency/gmd:MD_MaintenanceFrequencyCode[@codeList="http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode"]/@codeListValue');
+ $updateFrequency = $updateFrequency[0];
+ //TODO: push codelists into conf files !
+ //http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode
+ $codeListUpdateFrequencyArray = array('continual','daily','weekly','fortnightly','monthly','quarterly','biannually','annually','asNeeded','irregular','notPlanned','unknown');
+ if (in_array($updateFrequency, $codeListUpdateFrequencyArray)) {
+ $this->updateFrequency = $updateFrequency;
+ }
$this->qualifyMetadata();
return $this;
} else {
@@ -1058,6 +1082,7 @@
$this->harvestException = $row['harvestexception'];//"";
$this->lineage = $row['lineage'];//"";
$this->inspireTopConsistence = $row['inspire_top_consistence'];//"f";
+ $this->inspireInteroperability = $row['inspire_interoperability'];//"f";
$this->spatialResType = $row['spatial_res_type'];//"";
$this->spatialResValue = $row['spatial_res_value'];//"";
$this->export2Csw = $row['export2csw'];//"t";
@@ -1862,7 +1887,7 @@
//insert an instance for iso19139 into mapbenders database
$e = new mb_notice("class_iso19139.php: insert metadata with title: ".$this->title);
$sql = <<<SQL
-INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom, transfer_size, fees, md_license_source_note, constraints, responsible_party_name, responsible_party_email, preview_image, fkey_mb_group_id, md_proxy) VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44)
+INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom, transfer_size, fees, md_license_source_note, constraints, responsible_party_name, responsible_party_email, preview_image, fkey_mb_group_id, md_proxy, inspire_interoperability) VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45)
SQL;
$v = array(
$this->href,
@@ -1908,13 +1933,14 @@
$this->resourceContactEmail,
$this->previewImage,
$this->fkey_mb_group_id,
- $this->mdProxy
+ $this->mdProxy,
+ $this->inspireInteroperability
);
//$e = new mb_exception($this->tmpExtentBegin);
//$e = new mb_exception($this->tmpExtentEnd);
//$e = new mb_exception($this->createDate);
//$e = new mb_exception($this->changeDate);
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b');
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b','b');
$res = db_prep_query($sql,$v,$t);
return $res;
}
@@ -1965,7 +1991,7 @@
}
public function updateMetadataById($metadataId) {
- $e = new mb_exception("update metadata id: ".$metadataId);
+ $e = new mb_notice("update metadata id: ".$metadataId);
//check if the timestamp of an existing metadata element is not newer than the timestamp of the current metadata object!!!!
//TODO
//problem: <<<SQL have a limited number of chars!
@@ -1973,7 +1999,7 @@
$sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
$sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
$sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
- $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43, md_proxy = $44 WHERE metadata_id = $19";
+ $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43, md_proxy = $44, inspire_interoperability = $45 WHERE metadata_id = $19";
//$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
//$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
$v = array(
@@ -2021,16 +2047,15 @@
$this->resourceContactEmail,
$this->previewImage,
$this->fkey_mb_group_id,
- $this->mdProxy
+ $this->mdProxy,
+ $this->inspireInteroperability
);
//$e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b');
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b','b');
$res = db_prep_query($sql,$v,$t);
return $res;
}
-
-
public function insertMetadataUrlToDB($resourceType, $resourceId){
//check if metadata record already exists, if not create a new one else insert relation only!
$metadataId = $this->isLinkAlreadyInDB();
@@ -2066,7 +2091,6 @@
);
$t = array('s','s','s','s','b','s','i','i','s');
}
-
$res = db_prep_query($sql,$v,$t);
if(!$res){
db_rollback();
Modified: trunk/mapbender/http/plugins/mb_metadata_addon.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_addon.php 2017-01-09 13:28:02 UTC (rev 9640)
+++ trunk/mapbender/http/plugins/mb_metadata_addon.php 2017-01-09 15:21:04 UTC (rev 9641)
@@ -203,7 +203,10 @@
<input class="required" name="spatial_res_value" id="spatial_res_value"/>
</fieldset>
<!-- Dropdown List of CRS which are defined in mapbender.conf. For those CRS the layer extents will be computed by mapbender - this is relevant for INSPIRE.-->
-
+ <fieldset id="interoperability">
+ <legend><?php echo _mb("INSPIRE interoperability");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Flag which show, that the provided dataset should be compliant to the Interoperability Regulation. This means, that the data itself is provided in the INSPIRE data model.");?>'}" src="../img/questionmark.png" alt="" /></legend>
+ <input name="inspire_interoperability" id="inspire_interoperability" type="checkbox"/>
+ </fieldset>
<fieldset id="consistance">
<legend><?php echo _mb("Topological Consistency");?><img class="help-dialog" title="<?php echo _mb("Help");?>" help="{text:'<?php echo _mb("Correctness of the explicitly encoded topological characteristics of the data set as described by the scope. This element is mandatory only if the data set includes types from the Generic Network Model and does not assure centreline topology (connectivity of centrelines) for the network.");?>'}" src="../img/questionmark.png" alt="" /></legend>
<input name="inspire_top_consistence" id="inspire_top_consistence" type="checkbox"/>
Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php 2017-01-09 13:28:02 UTC (rev 9640)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php 2017-01-09 15:21:04 UTC (rev 9641)
@@ -1188,6 +1188,17 @@
default:
break;
}
+ $inspire_interoperability = $mbMetadata->inspireInteroperability; //boolean
+ switch ($inspire_interoperability) {
+ case "t" :
+ $resultObj["inspire_interoperability"] = true;
+ break;
+ case "f" :
+ $resultObj["inspire_interoperability"] = false;
+ break;
+ default:
+ break;
+ }
switch ($mbMetadata->inspireDownload) {
case 0 :
$resultObj["inspire_download"] = false;
@@ -1319,6 +1330,11 @@
} else {
$mbMetadata->inspireTopConsistence = 'f';
}
+ if ($data->inspire_interoperability) {
+ $mbMetadata->inspireInteroperability = 't';
+ } else {
+ $mbMetadata->inspireInteroperability = 'f';
+ }
if ($data->inspire_download) {
$mbMetadata->inspireDownload = 1;
} else {
@@ -1498,6 +1514,12 @@
} else {
$data->inspire_top_consistence = 'f';
}
+ //interoperability
+ if ($data->inspire_interoperability == "on") {
+ $data->inspire_interoperability = 't';
+ } else {
+ $data->inspire_interoperability = 'f';
+ }
//generate a uuid for the record:
$uuid = new Uuid();
//initialize database objects
@@ -1531,6 +1553,11 @@
} else {
$mbMetadata->inspireTopConsistence = "f";
}
+ if (isset($data->inspire_interoperability)) {
+ $mbMetadata->inspireInteroperability = $data->inspire_interoperability;
+ } else {
+ $mbMetadata->inspireInteroperability = "f";
+ }
if (isset($data->tmp_reference_1)) {
$mbMetadata->tmpExtentBegin = $data->tmp_reference_1;
}
More information about the Mapbender_commits
mailing list