DiGIR data sources

To configure a DiGIR Fetcher it is often more efficient to copy the default DiGIR Fetcher and customise the copy. The default DiGIR fetcher can be found in:

web/webservices/portal/fetchers/DefaultDigir.php

Copy this to:

~web/webservices/portal/CLIENT/fetchers/XXXXXDigir.php

where:

CLIENT

is the back-end client name of your EMu implementation. For example, CLIENT would be replaced by am for the Australian Museum, nhm for the Natural History Museum, dpiq for Department of Primary Industry Queensland, etc.

XXXXX

is a suitable name e.g. SmithsonianDigir.php or BerkeleyDigir.php, etc.

Edit the new fetcher:

<?php
/**
** The Local Default Fetcher
** This fetcher should connect to a standard EMu DiGIR Provider set up on this
* host
** Copyright (c) 2008 - KE Software Pty Ltd
** @package EMuWebServices
**/
if (!isset($WEB_ROOT))
{
	// Fetchers may live in 2 places - the default or the client localised
	// path.
	if (preg_match("/portal.fetchers/",realpath(__FILE__)))
		$WEB_ROOT = dirname(dirname(dirname(dirname(realpath(__FILE__)))));
	else	
		$WEB_ROOT = dirname(dirname(dirname(dirname(dirname(realpath(__FILE__))))));
}
require_once ($WEB_ROOT . '/objects/lib/webinit.php');
require_once ($WEB_ROOT . '/webservices/portal/DigirFetcher.php');
class DefaultDigirFetcher extends DigirFetcher
{
	var 	$enabled = false;
	var 	$serviceName = "LocalDigirFetcher";
	/*  Describe Digir configuration parameters
	 *  of the source
	*/
	var 	$sourceName = "EMu (EMu-DiGIR.02)";
	var	$hostname = "localhost";
	var	$port = 80;
	var	$resource = "EMu";
	var 	$preferredRGB = '#eeffaa';
	var 	$preferredIcon = '';
	var 	$caheIsOn = false;
	function DefaultDigirFetcher($instanceDir='',$backendType='',$webRoot='',$webDirName='',$debugOn='')
	{
		$this->{get_parent_class(__CLASS__)}($instanceDir,$backendType,$webRoot,$webDirName,$debugOn);
		// data source is local EMu-DiGIR service
		$this->provider = $this->webDirName . "/webservices/digir.php";
		// used to set queryable fields.  May also participate in
		// "SELECT" type statement when querying data source.
		// Returned fields will be translated from source field to
		//   syntax:
		// setKnownConcept(Concept,DataSourceField,[ExampleValue])
		$this->setKnownConcept("IRN","CatalogNumberNumeric","","integer");
		$this->setKnownConcept("Family","Family","Unionidae");
		$this->setKnownConcept("Genus","Genus");
		$this->setKnownConcept("Species","Species");
		$this->setKnownConcept("Latitude","DecimalLatitude","","float");
		$this->setKnownConcept("Longitude","DecimalLongitude","","float");
	}
	function describe()
	{
		return	
			"A Local Default Fetcher is a\n".
			"Fetcher that should connect to the local DiGIR service\n".
			"of the EMuWeb system the fetcher is configured on\n\n".
			parent::describe();  
	}
}
if (isset($_REQUEST['test']))
{
	if (basename($_SERVER['PHP_SELF']) == 'DefaultDigir.php')
	{
		$source = new DefaultDigirFetcher();
		$source->test(true);
	}
}
?>
  1. Globally replace:

    DefaultDigir

    with the name you gave your file. For example, DefaultDigir becomes SmithsonianDigir.

    In vi the global replace would be:

    :s/DefaultDigir/SmithsonianDigir/g

  2. Set enabled to true.
  3. Set sourceName to something suitable (this is a label for the data source as it displays in Web Maps). For example:

    $sourceName = "NYBG Digir Source";

  4. Set the hostname property appropriately.

    A DiGIR source is hosted by someone, somewhere. For example, the address of the DiGIR at the Museum of Comparative Zoology, Harvard University is http://digir.mcz.harvard.edu:80/digir/DiGIR.php. The hostname in this case = digir.mcz.harvard.edu

  5. Check that the port property is set appropriately. Usually, but not always:

    port = 80

    The port property is specified in the DiGIR source documentation.

  6. Using the setKnownConcept method associate generic field concepts used in Web Maps with DiGIR fields. For example:

    $this->setKnownConcept("Family","Family");

    $this->setKnownConcept("Genus","Genus");

    $this->setKnownConcept("Species","Species");

    $this->setKnownConcept("Latitude","DecimalLatitude","","float");

    $this->setKnownConcept("Longitude","DecimalLongitude","","float"

  7. Set any example query terms (this is optional).

    To create example or suggested test query terms, add a third argument to the knownConcept method. For example:

    $this->setKnownConcept("Family","Family","Unionidae");

    This will set an example value of Unionidae to be used for Family.

    Example value(s) can be useful for providing a quick test / trial query.