XUpdate

From NGDCWiki

(Difference between revisions)
Jump to: navigation, search
m
Current revision (14:36, 30 April 2013) (view source)
m (Replacing page with 'NMMR is deprecated and info is out of date - see history tab for previous content.')
 
Line 1: Line 1:
-
==XUpdate in the NMMR==
+
NMMR is deprecated and info is out of date - see history tab for previous content.
-
 
+
-
Modifications to a document in the NMMR using XUpdate can be made by selecting the appropriate record set and performing a search for the desired criteria.  From the search results page, select the checkbox next to the record(s) to be updated and select “XUpdate” from the navigation bar at the top of the page.  The resultant page will provide a text field into which an XUpdate query can be entered.
+
-
 
+
-
Please note that updates to component records must be made to the component record directly.  Changes cannot be made to component records by updating the record in which they are contained.
+
-
 
+
-
This feature can be very useful when it is necessary to perform an update across multiple records.
+
-
 
+
-
==XUpdate Overview==
+
-
 
+
-
Xupdate is an update language used for updating XML documents, utilizing the expression language defined by XPath to select XML node locations for insertion, removal, or modification.
+
-
===Basic Syntax===
+
-
====Namespace====
+
-
The XUpdate namespace has the URI <code><nowiki>http://www.xmldb.org/xupdate</nowiki></code>
+
-
====Selections====
+
-
XUpdate uses the expression language defined by XPath. XPath expressions are used in XUpdate for selecting nodes for processing
+
-
===Modifications===
+
-
====Elements of XUpdate Modifications====
+
-
 
+
-
Updates are represented by a "<code>xupdate:modifications</code>" element, followed by a version attribute (see examples below). Within the modifications element, the following elements may be used to perform various update functions:
+
-
 
+
-
<pre>
+
-
xupdate:insert-before
+
-
 
+
-
xupdate:insert-after
+
-
 
+
-
xupdate:append
+
-
 
+
-
xupdate:update
+
-
 
+
-
xupdate:remove
+
-
 
+
-
xupdate:rename
+
-
 
+
-
xupdate:variable
+
-
 
+
-
xupdate:value-of
+
-
 
+
-
xupdate:if
+
-
</pre>
+
-
 
+
-
Each of these elements may contain additional elements depending on their function. For example, the “<code>xupdate:insert-before</code>” element may contain the following types of elements:
+
-
 
+
-
<pre>
+
-
xupdate:element
+
-
 
+
-
xupdate:attribute
+
-
 
+
-
xupdate:text
+
-
 
+
-
xupdate:processing-instruction
+
-
 
+
-
xupdate:comment
+
-
</pre>
+
-
 
+
-
For more extensive information on the use of these elements and their applications, see the samples below or refer to the “Useful Links” section on this page.
+
-
 
+
-
====Element Attributes====
+
-
 
+
-
Many of these elements are required to be associated with specific attributes (e.g. select, name, etc.).  These attributes are associated with the element in the following manner:
+
-
<pre>
+
-
<xupdate:element1 attribute1=”attribute1_value” attribute2=”attribute2_value”>
+
-
 
+
-
</xupdate:element1>
+
-
</pre>
+
-
 
+
-
For more extensive information on the use of attributes, see the samples below or refer to the “Useful Links” section on this page.
+
-
 
+
-
==XUpdate in the NMMR==
+
-
 
+
-
Modifications to a document in the NMMR using XUpdate can be made by selecting the appropriate record set and performing a search for the desired criteria.  From the search results page, select the checkbox(s) next to the record(s) to be updated and select “XUpdate” from the navigation bar at the top of the page.  The resultant page will provide a text field into which an XUpdate query can be entered.
+
-
 
+
-
This feature can be very useful when it is necessary to perform an update across multiple records.
+
-
 
+
-
==XUpdate Samples==
+
-
 
+
-
===<xupdate:if> Example===
+
-
<pre><xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate">
+
-
 
+
-
<xupdate:if test="//theme[themekt='NASA/GCMD']">
+
-
 
+
-
<xupdate:append select="//theme[themekt='NASA/GCMD']">
+
-
 
+
-
<xupdate:element name="themekey">TEST 4</xupdate:element>
+
-
 
+
-
</xupdate:append>
+
-
 
+
-
</xupdate:if>
+
-
 
+
-
</xupdate:modifications></pre>
+
-
 
+
-
===Replace Metadata Keywords Sample===
+
-
#removes previous theme and place
+
-
#adds iso topic kewyords
+
-
#re-adds gcmd keywords
+
-
#re-adds place keywords
+
-
<pre><xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate">
+
-
 
+
-
<xupdate:remove select="/metadata/idinfo/keywords/theme"/>
+
-
 
+
-
<xupdate:remove select="/metadata/idinfo/keywords/place"/>
+
-
 
+
-
<xupdate:append select="/metadata/idinfo/keywords">
+
-
 
+
-
<xupdate:element name="theme">
+
-
 
+
-
<themekt>ISO 19115 Topic Category</themekt>
+
-
 
+
-
<themekey>climatologyMeteorologyAtmosphere</themekey>
+
-
 
+
-
</xupdate:element></nowiki><br />
+
-
 
+
-
<xupdate:element name="theme">
+
-
 
+
-
<themekt>
+
-
 
+
-
NASA/GCMD Earth Science Keywords at http://gcmd.nasa.gov/Resources/valids/gcmd_parameters.html
+
-
 
+
-
</themekt>
+
-
 
+
-
<themekey>EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature</themekey>
+
-
 
+
-
</xupdate:element>
+
-
 
+
-
<xupdate:element name="place">
+
-
 
+
-
<placekt>NASA/GCMD Location Keywords at http://gcmd.nasa.gov/Resources/valids/location.html</placekt>
+
-
 
+
-
<placekey>Great Lakes</placekey>
+
-
 
+
-
</xupdate:element>
+
-
 
+
-
</xupdate:append>
+
-
 
+
-
</xupdate:modifications></pre>
+
-
 
+
-
===Appends Local Extension Information===
+
-
<pre><xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate">
+
-
 
+
-
<xupdate:append select="/metadata/metainfo">
+
-
 
+
-
<xupdate:element name="metextns">
+
-
 
+
-
<onlink>http://www.ngdc.noaa.gov/metadata/extensions/local_extensions.html</onlink> <metprof>NGDC Extensions to FGDC
+
-
 
+
-
Metadata</metprof>
+
-
 
+
-
</xupdate:element>
+
-
 
+
-
</xupdate:append>
+
-
 
+
-
</xupdate:modifications></pre>
+
-
 
+
-
==Useful Links==
+
-
[http://xmldb-org.sourceforge.net/xupdate/xupdate-wd.html XML:DB Initiative: XUpdate]<br />
+
-
[http://www.xmldatabases.org/projects/XUpdate-UseCases/ XML:DB XUpdate Use Cases]
+
-
 
+
-
[[Category:Metadata]]
+

Current revision

NMMR is deprecated and info is out of date - see history tab for previous content.

Personal tools