CS331: Advanced Database Systems: Semistructured Data Management - PowerPoint PPT Presentation

Loading...

PPT – CS331: Advanced Database Systems: Semistructured Data Management PowerPoint presentation | free to download - id: 1391f0-MDAzN



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

CS331: Advanced Database Systems: Semistructured Data Management

Description:

Semistructured data management is at the confluence of these two views. ... body bgcolor='#ffffff' text='#000000' h1 Rome /h1 /body /html End tag. Start tag ... – PowerPoint PPT presentation

Number of Views:99
Avg rating:3.0/5.0
Slides: 80
Provided by: Nor50
Learn more at: http://www.cs.man.ac.uk
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: CS331: Advanced Database Systems: Semistructured Data Management


1
CS331 Advanced Database Systems Semistructured
Data Management
  • Norman Paton
  • University of Manchester
  • npaton_at_manchester.ac.uk

2
Semistructured Data
  • Two views of data
  • Databases structured, modelled, queried,
    programmed.
  • Documents partially structured, authored, read,
    navigated.
  • Semistructured data management is at the
    confluence of these two views.
  • XML is the principal data representation notation
    for semistructured data.
  • XML can be seen as
  • An extensible markup language for documents.
  • A data model for hierarchical data.
  • A notation for communicating data with its
    structure.

See also COMP30352 IR, Hypermedia and the Web
3
XML Language Space
  • XML (Extensible Markup Language) is just that a
    markup language with an extensible collection of
    tags.
  • XML is associated with many related standards
    within the W3C (World Wide Web Consortium)
    http//www.w3.org/.
  • XML Related Standards
  • XPath navigation.
  • XQuery queries.
  • XSLT transformations.
  • XML Schema document description.
  • DOM modelling documents as objects.
  • ...
  • ... and underpins
  • Web Services.
  • The Semantic Web.

4
Markup
  • Markup is the inclusion of symbols with special
    meaning in a text document.
  • Languages with markup
  • LaTeX.
  • HTML.
  • RTF.
  • XML.

lt!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"gt lthtmlgt ltheadgt lttitlegtThe
Silver Pigslt/titlegt lt/headgt ltbody
bgcolor"ffffff" text"000000gt
lth1gtRomelt/h1gt
\documentclassllncs \begindocument \titleAn
Experimental Performance Evaluation of Join
Algorithms for Parallel Object Databases \author
Sandra Sampaio\inst1 \and Jim
Smith\inst2\and Norman W.
Paton\inst1\and Paul Watson\inst2 ...
5
XML Markup
Start tag
  • In XML, content is structured using tags.
  • Tags are distinguished by the characters lt and
    gt.
  • Tags often come in pairs, round some content, as
    start and end tags.

lthtmlgt ltheadgt lttitlegtThe Silver
Pigslt/titlegt lt/headgt ltbody bgcolor"ffffff"
text"000000gt lth1gtRomelt/h1gt ... lt/bodygt lt/h
tmlgt
End tag
6
Elements
  • An element is a meaningful unit of content
    enclosed by tags.
  • An application may be able to interpret an
    element.
  • Elements may be ordered or nested.
  • Context matters, especially given nesting.

ltstationgt ltnamegtOxford Roadlt/namegt
ltcitygtManchesterlt/citygt lt/stationgt
7
Element Hierarchies
  • An XML document essentially represents
    hierarchical data.
  • The elements in a well formed XML document will
    match and respect the hierarchy.

ltcountrygt ltnamegtUnited Kingdomlt/namegt
ltpeoplegt ltpopgt60094648 lt/popgt
ltmaleLEgt75.74lt/maleLEgt ltfemaleLEgt80.7lt/femaleL
Egt lt/peoplegt lt/countrygt
country
name
people
pop
maleLE
femaleLE
8
Attributes
ltstation updatedBy Fred Bloggs validUntil
22/06/2005gt ltnamegtOxford Roadlt/namegt
ltcitygtManchesterlt/citygt lt/stationgt
  • Attributes provide auxiliary information about
    elements.
  • Attributes are embedded within start tags, and
    have the form name value.

ltcountry sourcehttp//www.cia.govgt
ltnamegtUnited Kingdomlt/namegt ltpeoplegt
ltpopgt60094648 lt/popgt ltmaleLEgt75.74lt/maleLEgt
ltfemaleLEgt80.7lt/femaleLEgt lt/peoplegt
lt/stationgt
9
Models
  • An XML file may be able to contain any old tags,
    in any order or combination (while remaining
    well-formed).
  • Restrictions on the legal tags and values a
    document can contain may be specified using a DTD
    or an XML Schema.
  • A DTD (Document Type Definition) provides a
    concise syntax for modelling documents (but is on
    the way out).
  • An XML Schema definition is itself an XML
    document, which provides a wide range of
    modelling constructs for constraining other XML
    documents.

10
Trains in XML
  • Hierarchical models can capture most cycle-free
    data fairly naturally.
  • Hierarchical models, however, promote some
    concepts and demote others.
  • The relational model, by contrast, treats all
    concepts as (broadly) equal.
  • lttraingt
  • lttnogt3107101lt/tnogt
  • ltsourcegtEdinburghlt/sourcegt
  • ltdestinationgtLondonlt/destinationgt
  • ltvisitgt
  • ltnamegtEdinburghlt/namegt
  • lttimegt0600lt/timegt
  • lt/visitgt
  • ltvisitgt
  • ltnamegtYorklt/namegt
  • lttimegt0800lt/timegt
  • lt/visitgt
  • ltvisitgt
  • ltnamegtLondonlt/namegt
  • lttimegt1000lt/timegt
  • lt/visitgt
  • lt/traingt

11
Tools
  • XML is widely used, and many software systems can
    read/write XML formats.
  • Generic tools have also been developed for
    designing/editing XML.

XML Spy showing a valid XML file as text.
12
XML Spy
  • XML Spy supports
  • Editing.
  • Data modelling.
  • Validation.
  • Transformation.

XML Spy showing an XML schema document as a tree.
13
Oxygen
  • Oxygen supports
  • Editing.
  • Data modelling.
  • Validation.
  • Transformation.
  • Querying.

Oxygen showing an XML schema document as a Tree
and text.
14
XML Databases
  • Native XML Databases
  • Store XML in the database directly (native).
  • Make XML Schema the optional schema definition
    language.
  • Query the database using XML query languages
    (XPath/XQuery).
  • Program database data as XML data structures
    (XMLDB, DOM, ...).

An XPath query and result in eXist
15
XML Databases
  • Native XML databases
  • Tamino - Software AG
  • http//www.softwareag.com/tamino/.
  • eXist - Open Source
  • http//exist.sourceforge.net/.
  • Standard APIs
  • XMLDB Initiative http//www.xmldb.org/ Both
    Tamino and eXist provide XMLDB APIs.
  • XQJ XQuery API for Java Java community standard.

16
XML and Relational Databases
  • Storage options
  • Decomposed store an XML document in relational
    tables, and reconstruct on retrieval.
  • Composed store an XML document as an attribute
    of a relational table.
  • Retrieval options
  • Represent relational tables as XML (e.g. Java
    WebRowSet).
  • Relational vendors
  • Tend to support both composed and decomposed
    storage models.
  • Provide APIs that accommodate XML for data
    transport or display (e.g., in Web Services or
    for Web interface generation).

17
Summary
  • XML is becoming increasingly ubiquitous for data
    representation for
  • files, transport, storage, metadata.
  • Data management systems must support storage,
    querying and communication using XML.
  • Soon everything will be stored using XML? Dont
    believe it!

18
Further Reading
  • S. Abiteboul, P. Buneman, D. Suchi, Data on the
    Web, Morgan-Kaufmann, 1999.
  • N. Bradley, The XML Companion (3rd Edition),
    Addison-Wesley, 2002.

19
Data Modelling in XML
20
XML Schema
  • XML Schema is a W3C standard for modelling using
    XML.
  • An XML Schema definition is itself an XML
    document there is an XML Schema for XML Schema!
  • XML Schema files have a .xsd suffix XML data
    files have a .xml suffix.
  • An XML Schema can specify
  • Which elements are mandatory/optional.
  • Which attributes are mandatory/optional.
  • Element/attribute types.
  • Cardinalities.
  • Relative ordering.

21
Role of XML Schema
  • Unlike in relational/object databases
  • An XML database need not have a schema.
  • An XML schema may not be very prescriptive in
    terms of what can or cannot be stored.

22
Train Model
sequence
recurring sequence
23
Train ComplexType
ltxscomplexType name"TrainType"gt
ltxssequencegt ltxselement name"tno"
type"xsstring"/gt ltxselement
name"source" type"xsstring"/gt
ltxselement name"destination" type"xsstring"/gt
ltxssequence maxOccurs"unbounded"gt
ltxselement name"visit"gt
ltxscomplexTypegt
ltxssequencegt
ltxselement name"name" type"xsstring"/gt
ltxselement name"time"
type"xstime"/gt
lt/xssequencegt
lt/xscomplexTypegt lt/xselementgt
lt/xssequencegt lt/xssequencegt lt/xscomplex
Type
24
Elements
  • Elements are defined thus
  • ltelement name the-namegt.
  • Attributes associated with elements
  • type specifies the kind of content that an
    element with no attributes or sub-elements can
    have. Default imposes no constraints.
  • minOccurs, maxOccurs the number of times an
    element can occur. A value of unbounded allows
    open-ended cardinality. Default is once and only
    once.

25
Built-in Types
  • There are many built-in types
  • string.
  • integer, positiveInteger, negativeInteger.
  • short, long.
  • date, dateTime, time.
  • id, idref.
  • anyURI

26
Complex Elements
  • Any element with sub-elements or attributes is
    declared to have a complex type.
  • Sequence the sub-elements must appear in the
    given order.
  • Choice a selection is made from the
    sub-elements.
  • Both sequence and choice can have
    minOccurs/maxOccurs.

ltxselement name"visit"gt ltxscomplexTypegt
ltxssequencegt ltxselement name"name"
type..."/gt ltxselement name"time"
type..."/gt lt/xssequencegt
lt/xscomplexTypegt lt/xselementgt
27
Attributes
  • Attributes can be defined within complex types.
  • Attributes are optional unless userequired.
  • The resulting data file can populate the
    attribute.

lttrain ... xsitype"TrainType
engine"125"gt lttnogt3107101lt/tnogt
ltsourcegtEdinburghlt/sourcegt ltdestinationgtLondonlt/
destinationgt ltvisitgt ... lt/visitgt lt/traingt
ltxscomplexType name"TrainType"gt
ltxssequencegt ltxselement name"tno"
type"xsstring"/gt ... lt/xssequencegt
ltxsattribute name"engine" type"xsstring"/gt lt/x
scomplexTypegt
28
Building on Existing Types
  • New types can be constructed from existing types
    by
  • Extension for complex types, this means that new
    types can be defined that add attributes or
    elements to the type on which they are based.
  • Restriction for complex types, this means that
    new types can be defined with fewer attributes or
    elements, reduced cardinalities, etc.

29
Type Extensions Example
ltxscomplexType name"StationType"gt
ltxssequencegt ltxselement name"name"
type"xsstring"/gt ltxselement
name"type" type"xsstring"/gt
lt/xssequencegt lt/xscomplexTypegt ltxscomplexType
name"DistrictStationType"gt
ltxscomplexContentgt ltxsextension
base"StationType"gt ltxssequencegt
ltxselement name"main"
type"xsstring"/gt lt/xssequencegt
lt/xsextensiongt lt/xscomplexContentgt lt/xs
complexTypegt
30
Type Extensions in Use
ltxselement name"stations"gt
ltxscomplexTypegt ltxschoice
maxOccurs"unbounded"gt ltxselement
name"station" type"StationType"/gt
ltxselement name"districtStation"
type"DistrictStationType"/gt
lt/xschoicegt lt/xscomplexTypegt
ltstationsgt ltstationgt
ltnamegtLondonlt/namegt lttypegtmainlt/typegt
lt/stationgt ltdistrictStationgt
ltnamegtYorklt/namegt lttypegtdistrictlt/typegt
ltmaingtLondonlt/maingt lt/districtStationgt lt
/stationsgt
models
31
Cross References
  • Hierarchal models do not naturally support shared
    components.
  • In documents, cross-references and hyperlinks are
    very common.
  • XML has several cross-referencing schemes (e.g.,
    ID/IDREF, XPointer).
  • Within an XML document
  • A value of type ID must be unique.
  • A value of type IDREF must match some ID within
    the document.

32
ID and IDREF for Trains
ID used to identify station
IDREF used to reference station
33
XML Schema for ID/IDREF
ltxselement name"station"gt ltxscomplexTypegt
ltxssequencegt ltxselement
name"city" type"xsstring"/gt
ltxselement name"name" type"xsID"/gt
lt/xssequencegt lt/xscomplexTypegt lt/xselementgt
... ltxselement name"visit"gt
ltxscomplexTypegt ltxssequencegt
ltxselement name"name" type"xsIDREF"/gt
ltxselement name"time" type"xstime"/gt
lt/xssequencegt lt/xscomplexTypegt lt/xselem
entgt
34
Example What is the schema?
ltshiporder orderid"889923gt ltorderpersongtJohn
Smithlt/orderpersongt ltshiptogt ltnamegtOla
Nordmannlt/namegt ltaddressgtLanggt 23lt/addressgt
ltcitygt4000 Stavangerlt/citygt
ltcountrygtNorwaylt/countrygt lt/shiptogt ltitemgt
lttitlegtEmpire Burlesquelt/titlegt
ltquantitygt1lt/quantitygt ltpricegt10.90lt/pricegt
lt/itemgt ltitemgt lt/itemgt lt/shipordergt
35
Summary
  • XML data can be parsed, transmitted and queried
    in the absence of any formal description of its
    structure.
  • Many applications need to be able to make
    assumptions about the structure of documents they
    process.
  • XML Schema provides a wide range of modelling
    facilities for defining XML documents.

36
Further Reading
  • The W3C Consortium Tutorial is short but
    informative
  • http//www.w3schools.com/schema/
  • D. Fallside, XML Schema Part 0 Primer, 2001
  • http//www.w3.org/TR/xmlschema-0/
  • N. Bradley, The XML Companion (3rd Edition),
    Addison-Wesley, 2002.

37
Querying XML Documents using XPath and XQuery
38
XPath and XQuery
  • XPath is a W3C standard for addressing parts of
    an XML document.
  • XPath is widely used in XML languages and tools,
    including XQuery and XSLT.
  • XPath is not especially expressive.
  • XQuery is a W3C standard for accessing and
    restructuring XML documents.
  • XQuery is supported by several XML databases, but
    is less widely deployed than XPath.
  • XPath is used within XQuery.

39
Trains Model
  • The following diagram shows the XML schema of the
    data queried in the following example queries.

40
XPath
  • XPath uses path expressions to describe routes
    through documents.
  • These expressions address locations in a
    hierarchy in a way that is familiar from file
    systems (/books/chapters/chapter1).
  • XPath also includes a function library (shared
    with XQuery) for manipulating numerical, string,
    date, node and sequence values.
  • Standardisation XPath 1.0 has been a W3C
    standard since 1999 XPath 2.0 became a W3C
    standard in January 2007.

41
XPath Terminology
  • Nodes include elements, documents (root elements)
    and attributes nodes can be addressed using
    XPath.
  • XPath includes constructs for exploring
    relationships between nodes, such as parent,
    child, ancestor and descendent.

42
XPath Syntax
43
Simple Paths - 1
44
Simple Paths - 2
45
Duplicates
46
Predicates
47
Extracting Node Values
48
Aggregates
49
Parents
50
Positions in Sequences
51
XQuery
  • XQuery is intended to play the same sort of role
    for XML data as SQL plays for relational data.
  • XQuery is a functional language, and thus is
    declarative and compositional.
  • XQuery can be used to restructure XML data, as
    well as to ask questions about it.
  • XQuery became a W3C standard in January 2007.

52
XQuery Syntax
  • XQuery is based on FLOWR (pronounced flower)
    expressions
  • for clauses bind variables to values in streams
    of tuples
  • let clauses bind variables to the complete result
    of an expression
  • where clauses filter values in tuple streams
  • order by clauses sort tuple streams and
  • return clauses construct results.

53
Iteration and Filtering
54
Identifying Documents
55
Constructing Results
56
Ordering Results
57
Quantifiers
58
Implicit Quantification
59
Reorganisation
60
Examples
  • Write XQueries that
  • Return the number of visits paid to the most
    frequently visited station.
  • Return the names of the stations that received
    the most visits.

61
Further Reading
  • The W3C Consortium Tutorials are short but
    informative you should read these
  • http//www.w3schools.com/xpath/
  • http//www.w3schools.com/xquery/
  • There are many books on querying XML documents,
    e.g.
  • Howard Katz (ed), XQuery from the Experts,
    Addison Wesley, 2004.

62
XML Databases
63
Native XML Databases
  • Native XML databases support collections of XML
    documents.
  • Native XML databases provide light weight support
    for management of large document collections.
  • Such databases typically support
  • XPath and XQuery for querying.
  • XUpdate for manipulating documents.
  • The XMLDB API for programmatic access.

64
Accessing eXist
  • The top level of an eXist database is a
    collection collections in eXist are not typed.
  • Like a file system, a collection can contain
    other collections or documents.
  • The eXist client supports management of
    collections, uploading of documents, etc.

65
XMLDB
  • XMLDB provides a Java API similar in concept to
    JDBC.

Class cl Class.forName(org.exist.xmldb.Database
Impl) Database database (Database)cl.newInsta
nce() DatabaseManager.registerDatabase(database)
Collection col DatabaseManager.getCollection(
"xmldbexist//localhost8080/exist/xmlrpc/db"
) XPathQueryService service (XPathQueryService)
col.getService("XPathQueryService",
"1.0") ResourceSet result service.query(args0
) ResourceIterator i result.getIterator()
while(i.hasMoreResources()) Resource r
i.nextResource() System.out.println((String)r
.getContent())
66
XML In Oracle 10g
  • Oracle was not designed to store XML data.
    Extensions to support XML occur
  • In the server, so that Oracle can store XML data
    using tables or built-in types.
  • Around the server, so that XML data can be
    transferred to and from Oracle applications.

67
XML Type
  • Server datatype
  • Stored in the database.
  • Configurable storage options (CLOBS or by mapping
    to object relational structures).
  • Accessible through SQL, PL/SQL, Java.
  • Operations to
  • Create XML Type values.
  • Map to/from XML Type values.
  • Test properties of XML Type values.
  • Query the content of XML Type values using XPath.

68
Storing XMLType Values
  • XMLType values can be stored as column
    attributes.
  • Stored either through a mapping onto tables or as
    Character Large Objects (CLOBs).

create table franchise ( company varchar(40)
not null, franchise varchar(40) not null,
trains SYS.XMLTYPE not null, primary key
(company, franchise))
69
Operations on XMLTypes
SYS_XMLGEN
createXML
Relational Construct
XMLType
String
getStringVal()
extract
Number
getNumberVal()
70
Populating XMLTypes
  • Standard table and column modification operations
    apply to complete values of XMLType
  • Insert.
  • Delete.
  • Update.
  • The updateXML operation is provided for making
    changes within XMLType values.

insert into franchise values ( 'GNER', 'East
Coast Main Line', sys.XMLType.createXML(
'lttrainsgt lttraingt
lttnogt3107101lt/tnogt ltsourcegtEdinburghlt/sour
cegt ltdestinationgt London
lt/destinationgt ltvisitgt lt/visitgt
lt/traingt lt/trainsgt') )
71
XMLType Methods
  • existsNode() returns 0 if the XPath expression
    does not match the document, else 1
  • existsNode(xpath IN varchar2) RETURN number.
  • extract() returns the fragment that matches an
    XPath expression as an XMLType
  • extract(xpath IN varchar2) RETURN sys.XMLType.

72
Querying XML Documents
  • Classically, documents can be searched using
    regular expressions, which know nothing about
    their structure.
  • XML documents, however, have an explicit
    structure that can be exploited by query
    languages.
  • The two main XML query languages are
  • XPath supports navigation through a document
    structure.
  • XQuery supports SQL-style queries over
    documents.
  • XPath is currently most widely used, often in
    conjunction with other languages (XSLT, SQL, ).

73
XPath
  • An XPath expression matches nodes in a document.
  • An XPath expression may match a document 0, 1 or
    many times.
  • XPath is a W3C standard.
  • A single step path matches an element name that
    is a child of the current element, e.g.
  • visit.
  • A multiple step path matches nested elements,
    e.g.
  • visit/name.

74
XPath Expressions
  • A wildcard matches indirectly nested elements,
    e.g.
  • train//name.
  • An absolute path makes the root of the document
    the current element
  • /trains/train/source.
  • An element anywhere in a document can be matched
    by // at the start of an expression
  • //visit.
  • //visit/name.

75
Selecting XML From SQL
  • The function sys.XMLType.getStringVal converts
    its XMLType parameter into a string.
  • Retrieve details of GNER trains

select f. franchise, sys.XMLType.getStringVal(f.tr
ains) from franchise f where f.company'GNER'
East Coast Main Line lttrainsgt ... lt/traingt
76
Extracting Elements
  • The extract() method on XMLType can be used to
    access individual elements.
  • Retrieve the src and dst of GNER trains

select f.franchise, f.trains.extract('//s
ource').getStringVal() as src,
f.trains.extract('//destination').getStringVal()
as dst from franchise f where f.company'GNER'
East Coast Main Line ltsourcegtEdinburghlt/sourcegtlt
sourcegtYorklt/sourcegt ltdestinationgtLondonlt/destinat
iongtltdestinationgtLondonlt/destinationgt
77
Extracting Element Values
  • The text() function can extract element contents.

select f.franchise, f.trains.extract('//sourc
e/text()').getStringVal() as src,
f.trains.extract('//destination/text()').getString
Val() as dst from franchise f where
f.company'GNER'
East Coast Main Line EdinburghYork LondonLondon
78
Extracting for Comparison
  • Comparisons can be carried out either in XPath or
    in SQL.

select f.company from franchise f where
f.trains.existsnode('//visitname"York"') 1
select f.company from franchise f where
f.trains.extract('//visit/name/text()').getStringV
al() like 'York'
GNER
79
Testing Before Retrieval
  • To avoid including empty values in results, the
    existsNode() method can test for documents that
    match an Xpath expression.

select f.franchise, f.trains.extract('//train/tno'
).getStringVal() as tno from franchise f where
f.trains.existsnode('//train/tno') 1
East Coast Main Line lttnogt3107101lt/tnogt lttnogt46307
10lt/tnogt
80
XML In Relational Databases
  • XML is increasingly ubiquitous
  • Data for Web display.
  • Data in domain-specific standards.
  • Data for communication between web services.
  • Relational vendors want
  • Web pages to be generated from databases.
  • Their storage managers to support all forms of
    data management.
  • Database applications to be exposed as Web
    Services.
  • This means full support for XML input, output and
    storage.

81
Further Reading
  • Oracle 10g, XML DB Developers Guide Chapter 3
    Using Oracle XML DB.
  • Full documentation for eXist is available along
    with the software from
  • http//exist.sourceforge.net/

82
Extra Slides
83
XML Schema for Train
Namespace definitions
lt?xml version"1.0" encoding"UTF-8"?gt lt!--
edited with XMLSPY v5 rel. 4 U (http//www.xmlspy.
com) by Norman Paton --gt ltxsschema
targetNamespace"http//my-train.com/namespace"
xmlns"http//my-train.com/namesp
ace" xmlnsxs"http//www.w3.or
g/2001/XMLSchema"
elementFormDefault"qualified" attributeFormDefaul
t"unqualified"gt ltxselement name"train"
type"TrainType"gt ltxsannotationgt
ltxsdocumentationgtRoot elementlt/xsdocumentationgt
lt/xsannotationgt lt/xselementgt
Element name and Type.
84
Namespaces
  • Namespaces support simultaneous use of
    definitions from multiple files.
  • Elements and attributes from different namespaces
    are distinguished using the syntax prefixname,
    to give a qualified name.
  • The name is the normal element/attribute name.
  • The prefix is a name given to a namespace.
  • A namespace is a URL acting as a unique string.

85
Train Schema Namespaces
  • The targetNameSpace is the namespace of items
    defined in this file.
  • targetNamespacehttp//my-train.com/namespace.
  • The xmlns is the default namespace for
    unqualified items referenced in this file
  • xmlnshttp//my-train.com/namespace.
  • The names associated with XML Schema will be
    qualified using the prefix xs
  • xmlnsxshttp//www.w3.org/2001/XMLSchema.

86
Train XML Namespaces
  • Default as before, and xsi is defined as prefix
    for XMLSchemaInstance schema.
  • The schemaLocation attribute associates a xsd
    file with the default namespace.

lt?xml version"1.0" encoding"UTF-8"?gt lt!--
edited with XMLSPY v5 rel. 4 U (http//www.xmlspy.
com) by Norman Paton --gt lttrain
xmlns"http//my-train.com/namespace"
xmlnsxsi"http//www.w3.org/2001/XMLSchema-instan
ce" xsischemaLocation"http//my-train
.com/namespace
P\unix\XML\Trains\Train.xsd"
xsitype"TrainType"gt
87
XQuery Problem Solution
let stations //visit/name return max(for
s in distinct-values(stations) return
count(for v in stations where v s return
v)) let stations //visit/name let
mostvisits max(for s in
distinct-values(stations) return
count(for v in stations where v s return
v)) for station in distinct-values(stations) wh
ere count(for visit in stations where visit
station return visit) mostvisits return
station
About PowerShow.com