[:space:]]+[[:alnum:]/]", "\\0 ", $string);
$string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "\\0 ", $string);
$string = eregi_replace("\n", " ", $string);
return $string;
}
#***
$md_ident=array(
array( ibus => "object_node.fk_obj_uuid",
iso19139 => "MD_Metadata.parentIdentifier",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Identifikator des übergeordneten Objektes",
gdescription => ""),
array( ibus => "t01_object",
iso19139 => "MD_Metadata.fileIdentifier",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Objectidentifikator",
gdescription => ""),
array( ibus => "t01_object.obj_name",
iso19139 => "MD_Metadata.identificationInfo?",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Objektname",
gdescription => ""),
array( ibus => "t01_object.obj_class",
iso19139 => "",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "ID der Objektklasse",
gdescription => "Relevant sind 1 und 3"),
array( ibus => "t01_object.info_note",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.purpose",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Herstellungszweck",
gdescription => "Zusatzinformation"),
array( ibus => "t01_object.loc_descr",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.description",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Raumbezug:Erläuterung",
gdescription => "Raumbezug"),
array( ibus => "t01_object.time_from",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.....",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Zeitbezug des Dateninhalts von:",
gdescription => "Zeitbezug"),
array( ibus => "t01_object.time_to",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.....",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Zeitbezug des Dateninhalts bis:",
gdescription => "Zeitbezug"),
array( ibus => "t011_obj_literatur.base",
iso19139 => "MD_Metadata.identificationInfo.MD_Identification.descriptiveKeywords.MD_Keywords.keyword",
iso19139explode => "true" ,
inspire => "B 3.1 Keyword value",
inspiremandatory => "true",
iso_name => "descriptive Keywords",
html => "INSPIRE Thema",
gdescription => ""),
array( ibus => "t04_search.searchterm",
iso19139 => "MD_Metadata.identificationInfo.MD_Identification.descriptiveKeywords.MD_Keywords.keyword",
iso19139explode => "true" ,
inspire => "B 3.1 Keyword value",
inspiremandatory => "true",
iso_name => "descriptive Keywords",
html => "Suchbegriffe",
gdescription => ""),
array( ibus => "title",
iso19139 => "identificationInfo[1]/*/citation/*/title",
iso19139explode => "false" ,
inspire => "B 1.1 Resource title",
inspiremandatory => "true",
iso_name => "Title",
html => "Titel",
gdescription => ""),
array( ibus => "t0113_dataset_reference.reference_date",
iso19139 => "",
iso19139explode => "false" ,
inspire => "B 5.2 Date of publication",
inspiremandatory => "true",
iso_name => "Date of publication",
html => "Veröffentlichungsdatum",
gdescription => ""),
array( ibus => "t01_object.time_status",
iso19139 => "",
iso19139explode => "false" ,
inspire => "B 5.3 Date of revision",
inspiremandatory => "true",
iso_name => "Date of revision",
html => "Datum der letzten Überarbeitung",
gdescription => ""),
array( ibus => "txx", #to find
iso19139 => "",
iso19139explode => "false" ,
inspire => "B 5.4 Date of creation",
inspiremandatory => "true",
iso_name => "Date of creation",
html => "Erzeugungsdatum",
gdescription => ""),
array( ibus => "summary",
iso19139 => "identificationInfo[1]/*/abstract",
iso19139explode => "false" ,
inspire => "B 1.2 Resource abstract",
inspiremandatory => "true",
iso_name => "abstract",
html => "Zusammenfassung",
gdescription => ""),
array( ibus => "t011_obj_serv.type",
iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceType",
iso19139explode => "false" ,
inspire => "B 2.2 Spatial data service type",
inspiremandatory => "true",
iso_name => "ServiceType",
html => "Typ des Dienstes",
gdescription => ""),
array( ibus => "t011_obj_serv_version.version",
iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceTypeVersion",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "Service Type Version",
html => "Version des Dienstes",
gdescription => ""),
array( ibus => "x1",
//array( ibus => "spatial_ref_value.x1",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.WestBoundLongitude",
iso19139explode => "false" ,
inspire => "B 4.1 Geographic bounding box - western longitude",
inspiremandatory => "true",
iso_name => "WestBoundLongitude",
html => "Westliche Begrenzung (geographische Länge)",
gdescription => ""),
array( ibus => "y1",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.SouthBoundLatitude",
iso19139explode => "false" ,
inspire => "B 4.1 Geographic bounding box - southern latitude",
inspiremandatory => "true",
iso_name => "SouthBoundLatitude",
html => "Südliche Begrenzung (geographische Breite)",
gdescription => ""),
array( ibus => "x2",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.EastBoundLongitude",
iso19139explode => "false" ,
inspire => "B 4.1 Geographic bounding box - eastern longitude",
inspiremandatory => "true",
iso_name => "EastBoundLongitude",
html => "Östliche Begrenzung (geographische Länge)",
gdescription => ""),
array( ibus => "y2",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.extent.EX_GeographicBoundingBox.NorthBoundLatitude",
iso19139explode => "false" ,
inspire => "B 4.1 Geographic bounding box - northern latitude",
inspiremandatory => "true",
iso_name => "NorthBoundLatitude",
html => "Nördliche Begrenzung (geographische Breite)",
gdescription => ""),
array( ibus => "t01_object.metadata_language",
iso19139 => "MD_Metadata.language",
iso19139explode => "false" ,
inspire => "B 10.3 Metadata language",
inspiremandatory => "true",
iso_name => "Metadata language",
html => "Sprache des Metadatensatzes",
gdescription => ""),
array( ibus => "summary",
iso19139 => "MD_Metadata.identificationInfo.MD_Identification.citation.CI_Citation.alternateTitle",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "Dataset alternate title",
html => "Kurzbezeichnung",
gdescription => ""),
array( ibus => "t011_object_geo.special_base",
iso19139 => "MD_Metadata.dataQualityInfo.lineage.LI_Lineage.statement",
iso19139explode => "false" ,
inspire => "B 6.1 Lineage",
inspiremandatory => "true",
iso_name => "B 1.6 Lineage",
html => "Informationen zum Herstellungsprozess",
gdescription => ""),
array( ibus => "t011_object_geo.rec_exact",
iso19139 => "MD_Metadata.dataQualityInfo.lineage.DQ_DataQuality.report.DQ_RelativeInternalPositionAccuracy.value",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Fachliche Grundlage",
gdescription => ""),
array( ibus => "t011_object_geo_scale.scale",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.equivalentScale.MD_RepresentativeFraction.denominator",
iso19139explode => "false" ,
inspire => "B 6.2 Spatial Resolution",
inspiremandatory => "true",
iso_name => "",
html => "Erstellungsmaßstab->Maßstab",
gdescription => ""),
array( ibus => "t011_object_geo_scale.resolution_ground",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance",
iso19139explode => "false" ,
inspire => "B 6.2 Spatial Resolution",
inspiremandatory => "true",
iso_name => "",
html => "Erstellungsmaßstab->Bodenauflösung",
gdescription => ""),
#The resolutions for services will be hold in different objects!
array( ibus => "t011_object_serv_scale.scale",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.equivalentScale.MD_RepresentativeFraction.denominator",
iso19139explode => "false" ,
inspire => "B 6.2 Spatial Resolution",
inspiremandatory => "true",
iso_name => "",
html => "Erstellungsmaßstab->Maßstab",
gdescription => "Auflösung bei Diensten"),
array( ibus => "t011_object_serv_scale.resolution_ground",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance",
iso19139explode => "false" ,
inspire => "B 6.2 Spatial Resolution",
inspiremandatory => "true",
iso_name => "",
html => "Erstellungsmaßstab->Bodenauflösung",
gdescription => "Auflösung bei Diensten"),
array( ibus => "t011_obj_geo_spatial_rep",
iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.spatialRepresentationType.MD_SpatialRepresentationTypeCode",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Digitale Repräsentation",
gdescription => ""),
array( ibus => "t011_obj_geo.hierarchy_level",
iso19139 => "MD_Metadata.hierachyLevelName",
iso19139explode => "true" ,
inspire => "B 1.3 Resource Type",
inspiremandatory => "true",
iso_name => "hierachyLevelName",
html => "Datensatz/Datenserie",
gdescription => ""),
array( ibus => "t012_obj_obj.object_from_id",
iso19139 => "MD_Metadata.parentIdentifier",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "Parent Identifier",
html => "Identifikator des übergeordneten Datensatzes",
gdescription => ""),
array( ibus => "t02_address.city",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Stadt",
gdescription => ""),
array( ibus => "t02_address.institution",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Organisation",
gdescription => ""),
array( ibus => "t02_address.firstname",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Vorname",
gdescription => ""),
array( ibus => "t02_address.lastname",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Nachname",
gdescription => ""),
array( ibus => "t02_address.postcode",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Postleitzahl",
gdescription => ""),
array( ibus => "t02_address.street",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Straße",
gdescription => ""),
array( ibus => "t021_communication.comm_value",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 10.1 Metadata point of contact email",
inspiremandatory => "true",
iso_name => "",
html => "Email - Verantwortlicher für Metadaten",
gdescription => ""),
array( ibus => "t011_obj_literature.publisher",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 10.1 Metadata Contact Organisation",
inspiremandatory => "true",
iso_name => "",
html => "Verantwortliche Organisation für Metadaten",
gdescription => ""),
array( ibus => "t011_obj_literature_publishing",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 9.1 Responsible party organisation",
inspiremandatory => "true",
iso_name => "",
html => "Verantwortliche Organisation",
gdescription => ""),
array( ibus => "t012_obj_adr.special_name",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 9.2 Responsible party role",
inspiremandatory => "true",
iso_name => "",
html => "Rolle der verantwortlichen Organisation",
gdescription => ""),
array( ibus => "t017_url_ref.content",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
iso_name => "",
html => "Art des Links",
gdescription => ""),
array( ibus => "t017_url_ref.url_link",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Link",
gdescription => ""),
array( ibus => "t01_object.obj_id",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Objektidentifikator",
gdescription => ""),
array( ibus => "t01_object.obj_uuid",
iso19139 => "?",
iso19139explode => "false" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "Eindeutiger Objektidentifikator",
gdescription => ""),
array( ibus => "t01_object.obj_id",
iso19139 => "",
iso19139explode => "false" ,
inspire => "B 1.5 Unique resource identifier",
inspiremandatory => "true",
iso_name => "",
html => "Name des Objektes",
gdescription => ""),
array( ibus => "t01_object.mod_time",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 10.2 Metadata date",
inspiremandatory => "true",
iso_name => "",
html => "Datum des Metadatensatzes",
gdescription => ""),
array( ibus => "t011_obj_serv_type.serv_type_key",
iso19139 => "MD_Metadata.identificationInfo.SV_ServiceIdentification.serviceTypeVersion",
iso19139explode => "" ,
inspire => "B 2.2 Spatial Data Service Type",
inspiremandatory => "true",
iso_name => "",
html => "Version des Services",
gdescription => ""),
array( ibus => "t011_obj_serv_op_connpoint.connect_point",
iso19139 => "",
iso19139explode => "" ,
inspire => "",
inspiremandatory => "false",
iso_name => "",
html => "URL zum Online Aufruf",
gdescription => ""),
array( ibus => "t01_object.avail_access_note",
iso19139 => "identificationInfo[1]/*/resourceConstraints/*/accessConstraints",
iso19139explode => "" ,
inspire => "B 8.1 Condition applying to access and use",
inspiremandatory => "true",
iso_name => "",
html => "Zugriffsbeschränkungen",
gdescription => ""),
array( ibus => "t01_object.fees",
iso19139 => "identificationInfo[1]/*/resourceConstraints/*/useLimitation",
iso19139explode => "" ,
inspire => "B 8.2 Limitations on public access",
inspiremandatory => "true",
iso_name => "",
html => "Kosten/Gebühren",
gdescription => ""),
array( ibus => "t01_object.data_language",
iso19139 => "",
iso19139explode => "" ,
inspire => "B 1.7 Resource Language",
inspiremandatory => "true",
iso_name => "",
html => "Sprache des Datensatzes",
gdescription => ""),
array( ibus => "t011_obj_geo_topic_cat.topic_category",
iso19139 => "identificationInfo[1]/*/topicCategory",
iso19139explode => "true" ,
inspire => "B 2.1 Topic Category",
inspiremandatory => "true",
iso_name => "Topic Category",
html => "Kategorie",
gdescription => "ISO Kategorie")
#array( ibus => "t011_obj_geo_topic_cat.topic.topic_category",
#iso19139 => "MD_Metadata.identificationInfo.MD_DataIdentification.topicCategory",
#iso19139explode => "true" ,
#inspire => "",
#inspiremandatory => "false",
#iso_name => "Dataset topic category",
#html => "Kategorisierung",
#gdescription => "")
);
if(!isset($_REQUEST["osid"]) )
{
echo "no opensearch id set";
die();
}
else
{
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
echo "opensearch interface no.: ".$_REQUEST["osid"]." will be requested ";
}
}
#***get the information out of the mapbender-db
#get url to search interface (opensearch):
$sql_os = "SELECT * from gp_opensearch where os_id = $1";
#do db select
$v_os = array($_REQUEST["osid"]);
$t_os = array('i');
$res_os = db_prep_query($sql_os,$v_os,$t_os);
#initialize count of search interfaces
$cnt_os = 0;
#initialize result array
$os_list=array(array());
#fill result array
while($row_os = db_fetch_array($res_os)){
$os_list[$cnt_os] ['id']= $row_os["os_id"];
$os_list[$cnt_os] ['name']= $row_os["os_name"];
$os_list[$cnt_os] ['url']= $row_os["os_url"];
$os_list[$cnt_os] ['h']= $row_os["os_h"];
$os_list[$cnt_os] ['standardfilter']= $row_os["os_standard_filter"];
#os_standard_filter
$cnt_os++;
}
#give out count of interfaces to use
#echo "\nCount of registrated OpenSearch Interfaces: ".count($os_list)."\n";
#***
#define opensearch detail url
$openSearchUrlDetail=$os_list[0] ['url']."detail?";
#get resultlists
$url=$openSearchUrlDetail."plugid=".$_REQUEST['plugid']."&docid=".$_REQUEST['docid'];
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
echo " REQUEST: ".$url." ";
}
#create connector object
$openSearchObject = new connector($url);
#get results
$openSearchDetail = $openSearchObject->file;
#save resultset in temporary folder identified by sessionid, katalog_id and page_id! Now there would be more tmp files than before!
#this has to be done in order to give the information to typo3
#**************to be done!************************************
#parse result to simplexml
#$openSearchXml=simplexml_load_string($openSearchDetail);
#parse result to simplexml
$openSearchDetailXML=simplexml_load_string($openSearchDetail);
#*****************************bbox********************************************
#do things for getting the bbox of the object in crs of last defined mapbender
#read out the epsg from session
#read out the bbox if exists
#transform bbox from wgs84 to last epsg of mapbender
#*****************************bbox********************************************
#extract objects to iso19139 elements
#count unidentified elements
$i=0;
#get list for ibus variables - cause php is row major
$ibus_names = array();
for($a = 0; $a < count($md_ident); $a++) {
$ibus_names[$a] = $md_ident[$a]["ibus"];
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
echo "ibus_names[".$a."]=".$md_ident[$a]["ibus"]." ";
}
}
#define array of key-value pairs
$detail_array=array();
#read key-value pairs
$j=0;
foreach ( $openSearchDetailXML->channel->item->details->detail as $detail) {
$detail_key=(string)$detail->{'detail-key'}; #cast explicitly to string
$detail_value=(string)$detail->{'detail-value'};
$detail_array[$detail_key] = $detail_value;
$detail_keys[$j]=$detail_key;
# echo "Key: ".$detail->{'detail-key'}." ";
# echo "array: ".$detail_array[$detail_key]." "; #gives values
#check if key is in array else count failures
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
if (in_array($detail_key, $ibus_names)) {
echo "Key ".$detail_key." exists in lookup table! ";
$i++;
}
}
$j++;
}
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
echo " ".$i." elements have been identified! ";
}
#$test1=in_array('t04_search.searchterm', $ibus_names);
#$test2=array_search('t04_search.searchterm', $ibus_names);
#if ($test1){echo "found at position: ".$test2." ";}
#else
#{echo "not found ";}
if(isset($_REQUEST["mdtype"])&($_REQUEST["mdtype"]=='debug') )
{
var_dump($detail_keys);
}
if ($_REQUEST['mdtype']=='debug'){
echo "DEBUG Metadatenanzeige ";
#define table
echo "
";
echo "";
#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
foreach ($detail_keys as $detailkey) {
#echo "";
if (in_array($detailkey, $ibus_names)==false){
echo " ".$detailkey." ";
}
else {
echo "".$md_ident[array_search($detailkey, $ibus_names)]['html']."(".$detailkey.") ";
}
#echo "";
echo "";
echo $detail_array[$detailkey];
echo " ";
}
echo "
";
}
if ($_REQUEST['mdtype']=='html'){
?>
GeoPortal Rheinland-Pfalz - Metadaten
';
?>
Detailinformationen:";
#define table
echo "
";
echo "";
#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
foreach ($detail_keys as $detailkey) {
if (in_array($detailkey, $ibus_names)==true){
echo "".$md_ident[array_search($detailkey, $ibus_names)]['html']." ";
echo "";
echo display_text($detail_array[$detailkey]);
echo " ";
}
}
echo "
";
}
if ($_REQUEST['mdtype']=='iso19139') {
//echo '
ISO19139 output comming soon! ';
$iso19139 = new DOMDocument('1.0');
$iso19139->encoding = 'UTF-8';
#$iso19139->standalone = false;
#Creating the "MD_Metadata" node
$MD_Metadata = $iso19139->createElementNS('http://www.isotc211.org/2005/gmd', 'gmd:MD_Metadata');
#$MD_Metadata=$iso19139->registerNamespace('srv','http://www.iso211.org/2005/srv');
#$wmt_ms_capabilities->setAttribute("updateSequence", $wms_row["wms_timestamp"]);
$MD_Metadata = $iso19139->appendChild($MD_Metadata);
$MD_Metadata->setAttribute("xmlns:srv", "http://www.isotc211.org/2005/srv");
$MD_Metadata->setAttribute("xmlns:gml", "http://www.opengis.net/gml");
$MD_Metadata->setAttribute("xmlns:gco", "http://www.isotc211.org/2005/gco");
$MD_Metadata->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
$MD_Metadata->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
$MD_Metadata->setAttribute("xsi:schemaLocation", "http://www.isotc211.org/2005/gmd ./xsd/gmd/gmd.xsd://www.isotc211.org/2005/srv ./xsd/srv/srv.xsd");
#generate language part B 10.3 (if available)
$language = $iso19139->createElement("gmd:language");
$languagecode = $iso19139->createElement("gmd:LanguageCode");
if (isset($detail_array['t01_object.metadata_language'])) {
$languageText = $iso19139->createTextNode($detail_array['t01_object.metadata_language']);
}
else {
$languageText = $iso19139->createTextNode("not yet defined");
}
$languagecode->appendChild($languageText);
$language ->appendChild($languagecode);
$language=$MD_Metadata->appendChild($language);
#generate MD_Scope part B 1.3 (if available)
$hierarchyLevel = $iso19139->createElement("gmd:hierarchyLevel");
$scopecode = $iso19139->createElement("gmd:MD_ScopeCode");
if (isset($detail_array['t011_obj_geo.hierarchy_level'])) {
$scopeText = $iso19139->createTextNode($detail_array['t011_obj_geo.hierarchy_level']);
}
else {
$scopeText = $iso19139->createTextNode("not yet defined");
}
$scopecode->appendChild($scopeText);
$hierarchyLevel->appendChild($scopecode);
$hierarchyLevel=$MD_Metadata->appendChild($hierarchyLevel);
#Part B 10.1
$contact=$iso19139->createElement("gmd:contact");
$CI_ResponsibleParty=$iso19139->createElement("gmd:CI_ResponsibleParty");
$organisationName=$iso19139->createElement("gmd:organisationName");
$organisationName_cs=$iso19139->createElement("gco:CharacterString");
if (isset($detail_array['t011_obj_literatur.publisher'])) {
$organisationNameText=$iso19139->createTextNode($detail_array['t011_obj_literatur.publisher']);
}
else
{
$organisationNameText=$iso19139->createTextNode('not given');
}
$contactInfo=$iso19139->createElement("gmd:contactInfo");
$CI_Contact=$iso19139->createElement("gmd:CI_Contact");
$address=$iso19139->createElement("gmd:address");
$CI_Address=$iso19139->createElement("gmd:CI_Address");
$electronicMailAddress=$iso19139->createElement("gmd:electronicMailAddress");
$electronicMailAddress_cs=$iso19139->createElement("gco:CharacterString");
if (isset($detail_array['t021_communication.comm_value'])) {
$electronicMailAddressText=$iso19139->createTextNode($detail_array['t021_communication.comm_value']);
}
else
{
$electronicMailAddressText=$iso19139->createTextNode('not given');
}
#create xml tree
$organisationName_cs->appendChild($organisationNameText);
$organisationName->appendChild($organisationName_cs);
$CI_ResponsibleParty->appendChild($organisationName);
$electronicMailAddress_cs->appendChild($electronicMailAddressText);
$electronicMailAddress->appendChild($electronicMailAddress_cs);
$CI_Address->appendChild($electronicMailAddress);
$address->appendChild($CI_Address);
$CI_Contact->appendChild($address);
$contactInfo->appendChild($CI_Contact);
$CI_ResponsibleParty->appendChild($contactInfo);
$contact->appendChild($CI_ResponsibleParty);
$MD_Metadata->appendChild($contact);
#generate dateStamp part B 10.2 (if available)
$dateStamp = $iso19139->createElement("gmd:dateStamp");
$mddate = $iso19139->createElement("gco:Date");
if (isset($detail_array['t01_object.mod_time'])) {
$mddateText = $iso19139->createTextNode($detail_array['t01_object.mod_time']);
}
else {
$mddateText = $iso19139->createTextNode("not yet defined");
}
$mddate->appendChild($mddateText);
$dateStamp->appendChild($mddate);
$dateStamp=$MD_Metadata->appendChild($dateStamp);
#do the things for identification
#create nodes
$identificationInfo=$iso19139->createElement("gmd:identificationInfo");
$MD_DataIdentification=$iso19139->createElement("gmd:MD_DataIdentification");
#add attribut
$MD_DataIdentification->setAttribute("id", "dataId");
$citation=$iso19139->createElement("gmd:citation");
$CI_Citation=$iso19139->createElement("gmd:CI_Citation");
#create nodes for things which are defined - howto do the multiplicities? Ask Martin!
#Create Resource title element B 1.1
$title=$iso19139->createElement("gmd:title");
$title_cs=$iso19139->createElement("gco:CharacterString");
if (isset($detail_array['title'])) {
$titleText = $iso19139->createTextNode($detail_array['title']);
}
else {
$titleText = $iso19139->createTextNode("not yet defined");
}
$title_cs->appendChild($titleText);
$title->appendChild($title_cs);
$CI_Citation->appendChild($title);
#Create date elements B5.2-5.4
#Do things for B 5.2 date of publication
if (isset($detail_array['t0113_dataset_reference.reference_date'])) {
$date1=$iso19139->createElement("gmd:date");
$CI_Date=$iso19139->createElement("gmd:CI_Date");
$date2=$iso19139->createElement("gmd:date");
$gcoDate=$iso19139->createElement("gco:Date");
$dateType=$iso19139->createElement("gmd:dateType");
$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
$dateTypeCodeText=$iso19139->createTextNode('publication');
$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
$dateTypeCode->appendChild($dateTypeCodeText);
$dateType->appendChild($dateTypeCode);
$gcoDate->appendChild($dateText);
$date2->appendChild($gcoDate);
$CI_Date->appendChild($date2);
$CI_Date->appendChild($dateType);
$date1->appendChild($CI_Date);
$CI_Citation->appendChild($date1);
}
#Do things for B 5.3 date of revision
if (isset($detail_array['t01_object.time_status'])) {
$date1=$iso19139->createElement("gmd:date");
$CI_Date=$iso19139->createElement("gmd:CI_Date");
$date2=$iso19139->createElement("gmd:date");
$gcoDate=$iso19139->createElement("gco:Date");
$dateType=$iso19139->createElement("gmd:dateType");
$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
$dateTypeCodeText=$iso19139->createTextNode('revision');
$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
$dateTypeCode->appendChild($dateTypeCodeText);
$dateType->appendChild($dateTypeCode);
$gcoDate->appendChild($dateText);
$date2->appendChild($gcoDate);
$CI_Date->appendChild($date2);
$CI_Date->appendChild($dateType);
$date1->appendChild($CI_Date);
$CI_Citation->appendChild($date1);
}
#Do things for B 5.4 date of creation
if (isset($detail_array['txx'])) {
$date1=$iso19139->createElement("gmd:date");
$CI_Date=$iso19139->createElement("gmd:CI_Date");
$date2=$iso19139->createElement("gmd:date");
$gcoDate=$iso19139->createElement("gco:Date");
$dateType=$iso19139->createElement("gmd:dateType");
$dateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
$dateTypeCodeText=$iso19139->createTextNode('creation');
$dateText= $iso19139->createTextNode($detail_array['t0113_dataset_reference.reference_date']);
$dateTypeCode->appendChild($dateTypeCodeText);
$dateType->appendChild($dateTypeCode);
$gcoDate->appendChild($dateText);
$date2->appendChild($gcoDate);
$CI_Date->appendChild($date2);
$CI_Date->appendChild($dateType);
$date1->appendChild($CI_Date);
$CI_Citation->appendChild($date1);
}
#Do things for B 1.5 Resource unique identifier
$identifier=$iso19139->createElement("gmd:identifier");
$rs_identifier=$iso19139->createElement("gmd:RS_Identifier");
$code=$iso19139->createElement("gmd:code");
$code_cs=$iso19139->createElement("gco:CharacterString");
$codeText=$iso19139->createTextNode($detail_array['t01_object.obj_id']);
$code_cs->appendChild($codeText);
$code->appendChild($code_cs);
$rs_identifier->appendChild($code);
$identifier->appendChild($rs_identifier);
$CI_Citation->appendChild($identifier);
#create tree
$citation->appendChild($CI_Citation);
$MD_DataIdentification->appendChild($citation);
#Create part for abstract B 1.2
$abstract=$iso19139->createElement("gmd:abstract");
$abstract_cs=$iso19139->createElement("gco:CharacterString");
if (isset($detail_array['summary'])) {
$abstractText = $iso19139->createTextNode($detail_array['summary']);
}
else {
$abstractText = $iso19139->createTextNode("not yet defined");
}
$abstract_cs->appendChild($abstractText);
$abstract->appendChild($abstract_cs);
$MD_DataIdentification->appendChild($abstract);
#End for abstract
#Create part for point of contact
#Define relevant objects
$pointOfContact=$iso19139->createElement("gmd:pointOfContact");
$CI_ResponsibleParty=$iso19139->createElement("gmd:CI_ResponsibleParty");
$organisationName=$iso19139->createElement("gmd:organisationName");
$orgaName_cs=$iso19139->createElement("gco:CharacterString");
$contactInfo=$iso19139->createElement("gmd:contactInfo");
$CI_Contact=$iso19139->createElement("gmd:CI_Contact");
$address_1=$iso19139->createElement("gmd:adress");
$CI_Address=$iso19139->createElement("gmd:CI_Address");
$electronicMailAddress=$iso19139->createElement("gmd:electronicMailAddress");
$email_cs=$iso19139->createElement("gco:CharacterString");
$role=$iso19139->createElement("gmd:role");
$CI_RoleCode=$iso19139->createElement("gmd:CI_RoleCode");
if (isset($detail_array['t011_obj_literature_publishing'])) {
$resOrgaText = $iso19139->createTextNode($detail_array['t011_obj_literature_publishing']);
}
else {
$resOrgaText= $iso19139->createTextNode("not yet defined");
}
if (isset($detail_array['tmail'])) {
$resMailText = $iso19139->createTextNode($detail_array['tmail']);
}
else {
$resMailText = $iso19139->createTextNode("really wanted by INSPIRE?");
}
if (isset($detail_array['t012_obj_adr.special_name'])) {
$resRoleText = $iso19139->createTextNode($detail_array['t012_obj_adr.special_name']);
}
else {
$resRoleText = $iso19139->createTextNode("not yet defined");
}
#put them in xml
$orgaName_cs->appendChild($resOrgaText);
$CI_ResponsibleParty->appendChild($orgaName_cs);
$email_cs->appendChild($resMailText);
$electronicMailAddress->appendChild($email_cs);
$CI_Address->appendChild($electronicMailAddress);
$address_1->appendChild($CI_Address);
$CI_Contact->appendChild($address_1);
$contactInfo->appendChild($CI_Contact);
$CI_ResponsibleParty->appendChild($contactInfo);
$CI_RoleCode->appendChild($resRoleText);
$role->appendChild($CI_RoleCode);
$CI_ResponsibleParty->appendChild($role);
$pointOfContact->appendChild($CI_ResponsibleParty);
$MD_DataIdentification->appendChild($pointOfContact);
#Part B 3 INSPIRE Category
#do only if INSPIRE keyword (Annex I-III) is set
if (isset($detail_array['t011_obj_literatur.base'])) {
$descriptiveKeywords=$iso19139->createElement("gmd:descriptiveKeywords");
$MD_Keywords=$iso19139->createElement("gmd:MD_Keywords");
$keyword=$iso19139->createElement("gmd:keyword");
$keyword_cs=$iso19139->createElement("gco:CharacterString");
$keywordText = $iso19139->createTextNode($detail_array['t011_obj_literatur.base']);
$thesaurusName=$iso19139->createElement("gmd:thesaurusName");
$CI_Citation=$iso19139->createElement("gmd:CI_Citation");
$title=$iso19139->createElement("gmd:title");
$title_cs=$iso19139->createElement("gco:CharacterString");
$titleText=$iso19139->createTextNode('GEMET Thesaurus version 1.0.0'); # to be adopted to get dynamically
$date_1=$iso19139->createElement("gmd:date");
$CI_Date=$iso19139->createElement("gmd:CI_Date");
$date_2=$iso19139->createElement("gmd:date");
$date_date=$iso19139->createElement("gco:Date");
$dateText=$iso19139->createTextNode('2008-12-08');
$dateType=$iso19139->createElement("gmd:dateType");
$CI_DateTypeCode=$iso19139->createElement("gmd:CI_DateTypeCode");
$CI_DateTypeCodeText=$iso19139->createTextNode('publication'); #to be adopted to get dynamically
#write to xml tree
$keyword_cs->appendChild($keywordText);
$keyword->appendChild($keyword_cs);
$MD_Keywords->appendChild($keyword);
$title_cs->appendChild($titleText);
$title->appendChild($title_cs);
$CI_DateTypeCode->appendChild($CI_DateTypeCodeText);
$dateType->appendChild($CI_DateTypeCode);
$date_date->appendChild($dateText);
$date_2->appendChild($date_date);
$CI_Date->appendChild($date_2);
$CI_Date->appendChild($dateType);
$date_1->appendChild($CI_Date);
$CI_Citation->appendChild($title);
$CI_Citation->appendChild($date_1);
$thesaurusName->appendChild($CI_Citation);
$MD_Keywords->appendChild($thesaurusName);
$descriptiveKeywords->appendChild($MD_Keywords);
$MD_DataIdentification->appendChild($descriptiveKeywords);
}
#Resource Constraints B 8
if (isset($detail_array['t01_object.avail_access_note'])){
$resourceConstraints1=$iso19139->createElement("gmd:resourceConstraints");
$MD_LegalConstraints1=$iso19139->createElement("gmd:MD_LegalConstraints");
$accessConstraints=$iso19139->createElement("gmd:accessConstraints");
$MD_RestrictionCode=$iso19139->createElement("gmd:MD_RestrictionCode");
$MD_RestrictionCodeText=$iso19139->createTextNode($detail_array['t01_object.avail_access_note']);
$MD_RestrictionCode->appendChild($MD_RestrictionCodeText);
$accessConstraints->appendChild($MD_RestrictionCode);
$MD_LegalConstraints1->appendChild($accessConstraints);
$resourceConstraints1->appendChild($MD_LegalConstraints1);
$MD_DataIdentification->appendChild($resourceConstraints1);
}
if(isset($detail_array['t01_object.fees'])){
$resourceConstraints2=$iso19139->createElement("gmd:resourceConstraints");
$MD_LegalConstraints2=$iso19139->createElement("gmd:MD_LegalConstraints");
$useLimitation=$iso19139->createElement("gmd:useLimitation");
$useLimitation_cs=$iso19139->createElement("gco:CharacterString");
$useLimitationText=$iso19139->createTextNode($detail_array['t01_object.fees']);
$useLimitation_cs->appendChild($useLimitationText);
$useLimitation->appendChild($useLimitation_cs);
$MD_LegalConstraints2->appendChild($useLimitation);
$resourceConstraints2->appendChild($MD_LegalConstraints2);
$MD_DataIdentification->appendChild($resourceConstraints2);
}
# Part B 1.7 Dataset Language
if(isset($detail_array['t01_object.data_language'])){
$language=$iso19139->createElement("gmd:language");
$LanguageCode=$iso19139->createElement("gmd:LanguageCode");
$LanguageCodeText=$iso19139->createTextNode($detail_array['t01_object.data_language']);
$LanguageCode->appendChild($LanguageCodeText);
$language->appendChild($LanguageCode);
$MD_DataIdentification->appendChild($language);
}
#Topic Category B 2.1
if(isset($detail_array['t011_obj_geo_topic_cat.topic_category'])){
$topicCategory=$iso19139->createElement("gmd:topicCategory");
$MD_TopicCategoryCode=$iso19139->createElement("gmd:MD_TopicCategoryCode");
$MD_TopicCategoryText=$iso19139->createTextNode($detail_array['t011_obj_geo_topic_cat.topic_category']);
$MD_TopicCategoryCode->appendChild($MD_TopicCategoryText);
$topicCategory->appendChild($MD_TopicCategoryCode);
$MD_DataIdentification->appendChild($topicCategory);
}
#Topic Category B 2.1
if(isset($detail_array['x1']) and isset($detail_array['x2']) and isset($detail_array['y1']) and isset($detail_array['y2'])){
$extent=$iso19139->createElement("gmd:extent");
$EX_Extent=$iso19139->createElement("gmd:EX_Extent");
$geographicElement=$iso19139->createElement("gmd:geographicElement");
$EX_GeographicBoundingBox=$iso19139->createElement("gmd:EX_GeographicBoundingBox");
$westBoundLongitude=$iso19139->createElement("gmd:westBoundLongitude");
$wb_dec=$iso19139->createElement("gco:Decimal");
$wb_text=$iso19139->createTextNode($detail_array['x1']);
$eastBoundLongitude=$iso19139->createElement("gmd:eastBoundLongitude");
$eb_dec=$iso19139->createElement("gco:Decimal");
$eb_text=$iso19139->createTextNode($detail_array['x2']);
$southBoundLatitude=$iso19139->createElement("gmd:southBoundLatitude");
$sb_dec=$iso19139->createElement("gco:Decimal");
$sb_text=$iso19139->createTextNode($detail_array['y1']);
$northBoundLatitude=$iso19139->createElement("gmd:northBoundLatitude");
$nb_dec=$iso19139->createElement("gco:Decimal");
$nb_text=$iso19139->createTextNode($detail_array['y2']);
$wb_dec->appendChild($wb_text);
$westBoundLongitude->appendChild($wb_dec);
$EX_GeographicBoundingBox->appendChild($westBoundLongitude);
$eb_dec->appendChild($eb_text);
$eastBoundLongitude->appendChild($eb_dec);
$EX_GeographicBoundingBox->appendChild($eastBoundLongitude);
$sb_dec->appendChild($sb_text);
$southBoundLatitude->appendChild($sb_dec);
$EX_GeographicBoundingBox->appendChild($southBoundLatitude);
$nb_dec->appendChild($nb_text);
$northBoundLatitude->appendChild($nb_dec);
$EX_GeographicBoundingBox->appendChild($northBoundLatitude);
$geographicElement->appendChild($EX_GeographicBoundingBox);
$EX_Extent->appendChild($geographicElement);
$extent->appendChild($EX_Extent);
$MD_DataIdentification->appendChild($extent);
}
$identificationInfo->appendChild($MD_DataIdentification);
$MD_Metadata->appendChild($identificationInfo);
header("Content-type: application/xhtml+xml; charset=UTF-8");
echo $iso19139->saveXml();
}
if ($_REQUEST['mdtype']=='inspire') {
?>
GeoPortal Rheinland-Pfalz - Metadaten
';
?>
INSPIRE Metadaten: ";
#define table
echo "
";
echo "";
#loop for each detail - tag - sometimes there are other tags in there - if one detail has more than one entry! - maybe this must be interpreted but later!
foreach ($detail_keys as $detailkey) {
if (in_array($detailkey, $ibus_names)==true){
if ($md_ident[array_search($detailkey, $ibus_names)]['inspiremandatory']=='true') {
echo "".$md_ident[array_search($detailkey, $ibus_names)]['inspire']." ";
echo "";
echo display_text($detail_array[$detailkey]);
echo " ";
}
}
}
echo "
";
echo '
INSPIRE output not completly implemented! ';
}
#phpinfo();
#$xmltest = new DOMDocument;
#$xmltest=simplexml_load_file('/home/armin/Desktop/GDI-RP/metadaten/detail_portalu.xml');
#$xsl = new DOMDocument;
#var_dump($xmltest);
//$xsl->load('simplesearch_overview.xsl');
#$xsl=simplexml_load_file('/home/workspace/mapbender_rp/http/geoportal/opensearch2html.xsl');
// Configure the transformer
#var_dump($xsl);
#$proc = new XSLTProcessor;
#$proc->importStyleSheet($xsl); // attach the xsl rules
#var_dump($proc);
#$trans = $proc->transformToXML($xmltest);
#var_dump($trans);
?>