Dan McCreary President Dan McCreary & Associates (952) M D

Slides:



Advertisements
Similar presentations
Minnesota Department of Education Metadata Registry Case Study Date: October 31 st, 2008 Dan McCreary President Dan McCreary & Associates
Advertisements

Using the Self Service BMC Helpdesk
OpenCMS and the MSASS Website. A Note on Terminology Locking a file for editing: No lockNOT locked You have write/edit access Someone else has write.
Library Online Catalog Tutorial Pentagon Library Last Updated March 2008.
Guide to using the myNATE website
Using oXygen Using oXygen to build and execute XQuery applications on eXist Date: September 2008 Dan McCreary President Dan McCreary & Associates
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
Resource Discovery Module DigiTool Version 3.0. Resource Discovery 2 Deposit Approval Search & Index Dispatcher & Viewers Single & Bulk Web Services DigiTool.
Overview of XPath Author: Dan McCreary Date: October, 2008 Version: 0.2 with TEI Examples M D.
Server-side Scripting Powering the webs favourite services.
Sample Auto-generated XForms With XQuery Date: 1/17/2009 Dan McCreary President Dan McCreary & Associates (952) M D Metadata.
Styling XForms Using CSS to make your forms look great Date: 10/9/2008 Dan McCreary President Dan McCreary & Associates (952)
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Metadata Management Case Study Date: 10/21/2008 Dan McCreary President Dan McCreary & Associates (952) M D Metadata Solutions.
1 OPOL Training (OrderPro Online) Prepared by Christina Van Metre Independent Educational Consultant CTO, Business Development Team © Training Version.
© MIT 2000 Building Web Applications With Webjects Michael D. Barker The MIT Educational Media Creation Center September 2001.
EXist Indexing Using the right index for you data Date: 9/29/2008 Dan McCreary President Dan McCreary & Associates (952) M.
Recursive Functions Creating Hierarchical Reports Date: 9/30/2008 Dan McCreary President Dan McCreary & Associates (952) M.
IFORM ACCOUNT MAINTENANCE ICT4D SESSION 4. IFORMBUILDER WEBSITE REQUIREMENTS To access the iFormBuilder website, you need the following items: -Reliable.
An Introduction to Designing and Executing Workflows with Taverna Aleksandra Pawlik materials by: Katy Wolstencroft University of Manchester.
XQuery Functions Reusing XQuery Code Date: September, 2008 Dan McCreary President Dan McCreary & Associates (952) M D Metadata.
Auto-generation of Repeated Elements Part 2 of a series of XForms auto generation Date: 1/25/2008 Dan McCreary President Dan McCreary & Associates
Keyword Searching Weighted Federated Search with Key Word in Context Date: 10/2/2008 Dan McCreary President Dan McCreary & Associates
XRX Basic CRUDS Create, Read, Update and Delete and Search XML Data Date: May 2011 Dan McCreary President Dan McCreary & Associates
Using oXygen 12 with XQuery Using oXygen to build and execute XQuery XQuery applications on eXist Date: April 2011 Dan McCreary President Dan McCreary.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
CharMeck.org Contributer Training SharePoint 2013 Orientation and Basic Training.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
Week 2: Building a Simple Website IMC 320 Web Publishing Spring 2011.
XQuery Labs Basic Reporting Date: 9/29/2008 Dan McCreary President Dan McCreary & Associates (952) M D Metadata Solutions.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASSIGNMENT 2 Salim Malakouti. Ticketing Website  User submits tickets  Admins answer tickets or take appropriate actions.
Complete Ordering System for Promotional Literature and Samples Quick Reference and Training Guide.
IBM Express Runtime Quick Start Workshop © 2007 IBM Corporation Deploying a Solution.
Fab25 User Training Cerium Labs LabCollector - LIMS Lynette Ballast.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED ADMINISTRATION.
1 Yoel Kortick Senior Librarian Working with the Alma Community Zone and Electronic Resources.
Migrating Wordpress Migrating Wordpress can sometimes get more complicated as it should. There is no plugin that does this for you, the best way is to.
Advanced HTML Tags:.
Architecture Review 10/11/2004
Web-RMA Quick Start Guide
Using the Personal Image Photo Library
Introduction to the new robust security system from SCC.
QuadriDCM Easy Access as a communication platform
NetApp Online Ordering User Tutorial
Using E-Business Suite Attachments
CARA 3.10 Major New Features
Global Grid Forum GridForge
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Creating Novell Portal Services Gadgets: An Architectural Overview
HR Portal Team Dr. Ashraf Armoush Supervisor Ala’eddeen Awwad
Welcome to the JCISD Teacher Website Training Guide
HW7: Database Application
Testing REST IPA using POSTMAN
TRAINING OF FOCAL POINTS on the CountrySTAT SYSTEM based on FENIX
Chair of Tech Committee, BetterGrids.org
CSDR Submit-Review Website Submitter Guide
5 Tips for Upgrading Reports to v 6.3
Activating Your Account and Navigating Through TIDE
Distributor Want aka. Dis-WAnt
Sequences in XQuery Core data structure of XQuery Date: 8/25/2009
Request Form You gain access to the Request Form from your intranet set-up by your IT dept. Or the internet via either our desktop launcher icon. Or a.
3rd Party Widgets & Custom Code
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
XRX Diagrams Application Architecture Diagrams Date: Aug 21st, 2008
Contract Management Software 100% Cloud-Based ContraxAware provides you with a deep set of easy to use contract management features.
What Can It Do For You? Spira | #InflectraCon
Presentation transcript:

XRX Basic CRUD Create, Read, Update and Delete XML Data Date: 10/1/2008 Dan McCreary President Dan McCreary & Associates dan@danmccreary.com (952) 931-9198 M D Metadata Solutions

Copyright 2008 Dan McCreary & Associates Outline Create new XML records using XForms assigning sequential ids to each item (save-new.xq) Listing items Creating a list of current items (list-items.xq) Reading XML records creating read-only views of items (view-item.xq) Update existing records use XQuery updates (update.xq) Deleting an item How to delete with confirmation (delete-confirm.xq) Searching How to build custom search forms Copyright 2008 Dan McCreary & Associates

Architecturally Significant Functions Once you learn the basics CRUD(S) functions you can start to customize the item-manager code (S is for Search) Additional functions don’t require you to learn any additional architectural features Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Sample Item To keep our examples simple, we are going to use a very simple “item” structure <item> <id>47</id> <name>Item Forty Seven</name> <description>This is a detailed description of item 47.</description> <category>medium</category> <status>draft</status> <tag>tag-1</tag> </item> Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Folder Structure /db apps item-manager data edit search views 1.xml 47.xml new-instance.xml search.xq view-item.xq 2.xml 99.xml next-id.xml search.xhtml list-items.xq edit.xq save-new.xq update.xq delete.xq Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates List Items Simple for loop for all items in the data collection Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates list-items.xq <table> <thead> <tr> <th>ID</th> <th>Name</th> … </tr> </thead> <tbody>{ for $item in collection($collection)/item let $id := $item/id/text() return <td>{$id}</td> <td>{$item/name/text()}</td> }</tbody></table> Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Item Viewer http://localhost:8080/exist/rest/db/apps/item-manager/views/view-item.xq?id=1 Always provide a read-only viewer for your items Never force a person to use a write/lock edit form to view a document This causes unnecessary locking in the database Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates view-item.xq let $id := request:get-parameter('id', '') … <h1>View Item</h1> {let $item := collection($collection)/item[id = $id] return <table> <tbody> <tr><th>ID:</th><td>{$item/id/text()}</td></tr> <tr><th>Name:</th><td>{$item/faq-category-id/text()}</td></tr> <tr><th>Description:</th><td>{$item/description/text()}</td></tr> <tr><th>Category:</th><td>{$item/category/text()}</td></tr> <tr><th>Status:</th><td>{$item/status/text()}</td></tr> <tr><th>Tag:</th><td>{$item/tag/text()}</td></tr> </tbody> </table> } Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates edit.xq Architecture Generates an XHTML XForms on the fly Works for both new items and updates to items Calls save-new.xq if it has a new item Calls update.xq if it is updating an existing item Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates edit.xq http://localhost:8080/exist/rest/db/apps/item-manager/edit/edit.xq?id=1 Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Excerpts from edit.xq let $new := request:get-parameter('new', '') let $id := request:get-parameter('id', '') … let $file := if ($new) then ('new-instance.xml') else ( concat( $server-port, '/exist/rest', $collection, '/', $id, '.xml')) <xf:submission id="save" method="post" action="{if ($new='true') then ('save-new.xq') else ('update.xq')}" instance="my-task" replace="all"/> Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates New Instance http://localhost:8080/exist/rest/db/apps/item-manager/edit/new-instance.xq <item> <id/> <name/> <description/> <category/> <status/> <tag/> </item> Contains initial values of default form. Booleans must have true/false set. Copyright 2008 Dan McCreary & Associates

XForms Controls for edit.xq <xf:input ref="name"> <xf:label>Name:</xf:label> </xf:input> <xf:textarea ref="description" class="description"> <xf:label>Question:</xf:label> </xf:textarea> <xf:select1 ref="category" class="category"> <xf:label>Category:</xf:label> <xf:item> <xf:label>Small</xf:label> <xf:value>small</xf:value> </xf:item> <xf:label>Medium</xf:label> <xf:value>medium</xf:value> <xf:label>Large</xf:label> <xf:value>large</xf:value> </xf:select1> Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates save-new.xq … (: this is gets the data from the XForms submission :) let $item := request:get-data() (: this creates the new file with a still-empty id element :) let $store := xmldb:store($data-collection, $file, $item) (: this adds the correct ID to the new document we just saved :) let $update-id := update replace doc(concat($data-collection, '/', $file))/item/id with <id>{$id}</id> (: this updates the next-id.xml file :) let $new-next-id := update replace doc($next-id-file-path)/data/next-id/text() with ($id + 1) return <html>… Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates update.xq … (: Get the data from the XForms POST submission :) let $item := request:get-data() (: this saves the new file and overwrites the old one :) let $store := xmldb:store($collection, $file, $item) return <html> <head> <title>Update Confirmation</title> </head> <body> <a href="../index.xhtml">Item Home</a> > <a href="../views/list-items.xq">List all Items</a> > <a href="../views/view-item.xq?id={$id}">View Item</a> <p>Item {$id} has been updated.</p> </body> </html> Note that save and update do not take URL parameters. They get all their data from the POST. Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates delete-confirm.xq xquery version "1.0"; let $id := request:get-parameter("id", "") … return <html> <body> <a href="../index.xhtml">Item Home</a> > <a href="../views/list-items.xq">List Items</a> <h1>Are you sure you want to delete this Item?</h1> <b>Name: </b>{doc($doc)/item/name/text()}<br/> <b>Path: </b> {$doc} <br/> <a class="warn" href="delete.xq?id={$id}">Yes - Delete This Item?</a> <a class="warn" href="../views/view-item.xq?id={$id}">Cancel (Back to View Item)</a> </body> </html> Note that save and update do not take URL parameters. They get all their data from the POST. Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates delete.xq let $collection := '/db/apps/manage-items/data' (: this script takes the integer value of the id parameter passed via get :) let $id := xs:integer(request:get-parameter('id', '')) (: this logs you into the collection :) let $login := xmldb:login($collection, ‘username', ‘password') (: this constructs the filename from the id :) let $file := concat($id, '.xml') (: this REALLY deletes the file :) let $store := xmldb:remove($collection, $file) return <html> Note that save and update do not take URL parameters. They get all their data from the POST. Copyright 2008 Dan McCreary & Associates

How CRUD Applications Work Together search.xhtml search.xq index.xhtml view-item.xq save-new.xq list-items.xq edit.xq optional update.xq delete-confirm.xq delete.xq Note: If you change a file name of an XQuery, make sure that everything that links to it is also updated Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Next Steps Create additional reports for users Customized dashboards Use status codes to filter data Data quality reports Customize Forms for specific users Add role-based functions so each role has custom views and forms Build custom searches for specific users Copyright 2008 Dan McCreary & Associates

Copyright 2008 Dan McCreary & Associates Thank You! Please contact me for more information: Native XML Databases Metadata Management Metadata Registries Service Oriented Architectures Business Intelligence and Data Warehouse Semantic Web Dan McCreary, President Dan McCreary & Associates Metadata Strategy Development dan@danmccreary.com (952) 931-9198 Copyright 2008 Dan McCreary & Associates