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:
|
is the back-end client name of your EMu implementation. For example, |
|
is a suitable name e.g. |
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);
}
}
?>
- 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
- Set
enabled
to true. - 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";
- 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
- Check that the port property is set appropriately. Usually, but not always:
port = 80
The port property is specified in the DiGIR source documentation.
- 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"
- 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.