Using Local Dictionaries

From The SBN Wiki
Revision as of 13:04, 22 July 2014 by Raugh (talk | contribs) (Safety Save)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A local dictionary is any dictionary other than the PDS4 master schema. These include both discipline dictionaries, like the Display Dictionary or the Spectral Dictionary, and mission dictionaries produced by data preparers as part of their archiving process.

Structure of Local Dictionaries

Like the PDS4 master schema, local dictionaries will usually come in two parts: the XML Schema Definition language, or XSD, file, which contains the structural class and attribute information; and the Schematron languade, or SCH, file, which contains standard value lists and attribute relationship requirements. Together, these two files constitute a dictionary that defines a specific and unique namespace. When you wish to use classes from this namespace in your PDS4 label, you will need to reference both of these files.

Where to Find Dictionaries

The officially configured and released dictionaries are available from this website at PDS:

http://pds.nasa.gov/pds4/schema/released/

Development versions should be used with caution, and are available elsewhere on the PDS4 site if desired.

Note: In general, you should not be using mission dictionaries for missions other than the mission you are actually working on/for. If this presents a problem, contact your SBN node consultant.


Schema Files

To use any particular dictionary, you will need to download both the .xsd and the .sch files. If you've set up a local schema archive, you can copy these files into the appropriate place and carry on.

Some software can also reference schema files across an available network connection, so it may not be necessary to have local copies of the files physically present on your system. You will need to know the specific URL, however.


Namespaces

A dictionary, that is, the combination of an .xsd file and its related .sch file, defines all the classes and attributes constituting a unique namespace. The formal name of that namespace will be a URI (Uniform Resource Identifier). For PDS4 namespaces, URIs are in the form of a URL. PDS maintains the dictionary collection at that URL, at least for now (there is no requirement that a URL-like URI be resolvable, but it does make life easier).

Finding the Dictionary Namespace URI

In order to reference the local dictionary in your labels, you will need to know the full, formal namespace URI.

To find the full namespace URI of a local dictionary, open the .xsd file and look at the contents of the <xs:schema> tag near the top of the file. Here, for example, is <xs:schema&gt tag from the version 1.1.0.0 Display Dictionary:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://pds.nasa.gov/pds4/disp/v1"
  xmlns:disp="http://pds.nasa.gov/pds4/disp/v1"
  xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified"
  version="1.1.0.0">

The URI of the namespace for any local dictionary is the value of the targetNamespace attribute in this tag. In the example above, we can see that the URI for the Display Dictionary namespace is "http://pds.nasa.gov/pds4/disp/v1".

The Standard Namespace Abbreviation

PDS also strongly prefers that you use standard namespace abbreviations for local dictionaries where abbreviations are called for. You can find the standard abbreviation in the <xs:schema> tag as well. Look for the xmlns: attribute that has the same value as the namespace URI for the dictionary, and the abbreviation will be the part following the colon. So in the example above, the standard abbreviation for the Display Dictionary namespace is "disp".

Setting Up for Validation

Referencing Local Dictionaries in PDS4 Labels

Schematron Reference

Namespace definition

XSD Reference

XML Catalog Files

Using Classes from a Namespace