Project

General

Profile

« Previous | Next » 

Revision 153

Added by Matt Jones over 24 years ago

added query language dtd and example file

View differences:

test-query.xml
1
<?xml version="1.0"?>
2
<!DOCTYPE pathquery PUBLIC "-//NCEAS//pathquery-1.0//EN" 
3
          "file:///home/jones/projects/pbi/development/mde/dtd/pathquery.dtd" >
4
<pathquery version="1.0">
5
  <meta_file_id>Example-01</meta_file_id>
6
  <querytitle>Community Dynamics data query</querytitle>
7
  <querygroup booleantype="AND">
8
    <queryterm casesensitive="false" searchmode="contains">
9
      <value>Insights</value>
10
      <pathexpr>/eml-dataset/title</pathexpr>
11
    </queryterm>
12
    <queryterm casesensitive="false" searchmode="contains">
13
      <value>community</value>
14
      <pathexpr>/eml-dataset/abstract</pathexpr>
15
    </queryterm>
16
  </querygroup>
17
</pathquery>
0 18

  
lib/test-query.xml
1
<?xml version="1.0"?>
2
<!DOCTYPE pathquery PUBLIC "-//NCEAS//pathquery-1.0//EN" 
3
          "file:///home/jones/projects/pbi/development/mde/dtd/pathquery.dtd" >
4
<pathquery version="1.0">
5
  <meta_file_id>Example-01</meta_file_id>
6
  <querytitle>Community Dynamics data query</querytitle>
7
  <querygroup booleantype="AND">
8
    <queryterm casesensitive="false" searchmode="contains">
9
      <value>Insights</value>
10
      <pathexpr>/eml-dataset/title</pathexpr>
11
    </queryterm>
12
    <queryterm casesensitive="false" searchmode="contains">
13
      <value>community</value>
14
      <pathexpr>/eml-dataset/abstract</pathexpr>
15
    </queryterm>
16
  </querygroup>
17
</pathquery>
0 18

  
lib/pathquery.dtd
1
<!--
2
  * pathquery.dtd
3
  *
4
  *      Authors: Matt Jones
5
  * Organization: National Center for Ecological Analysis and Synthesis
6
  *    Copyright: 2000 Regents of the University of California and the
7
  *               National Center for Ecological Analysis and Synthesis
8
  *  For Details: http://www.nceas.ucsb.edu/
9
  *      Created: 13 June 2000
10
  *    File Info: '$Id$'
11
  *
12
  * This DTD describes the structure and content of XML documents used
13
  * to represent, store, and exchange a simple path-based query expression.
14
  * This syntax represents a small subset of the capabilities of the XPath 
15
  * language (http://www.w3.org/TR/xpath), and is intended as a simple
16
  * query language for the metadata catalog database (mcdb).  It is 
17
  * intended that all expressions in this language can be mapped directly
18
  * into XPath syntax, but not all Xpath expressions can be mapped into this
19
  * syntax.
20
  *
21
  * Although ideally we would implement the query language as either the full
22
  * XPath language or as one of the emerging XML query languages (like
23
  * XML-QL or XQL), in practice this would be an involved undertaking that
24
  * doesn't necessarily have high payoffs.  But we will revisit this issue and
25
  * determine later whether these full-featured technologies are warranted
26
  * after we have some experience with a simpler implementation such as this.
27
-->
28

  
29
<!-- Overall query container -->
30
<!ELEMENT pathquery (meta_file_id, querytitle, querygroup)>
31

  
32
<!-- The version of this query specification -->
33
<!ATTLIST pathquery version CDATA #FIXED "1.0">
34

  
35
<!-- a unique identifier for this query document -->
36
<!ELEMENT meta_file_id (#PCDATA)>
37

  
38
<!-- a descriptive title for this query document -->
39
<!ELEMENT querytitle (#PCDATA)>
40

  
41
<!-- A group of related query terms -->
42
<!ELEMENT querygroup ( (queryterm|querygroup)+ )>
43

  
44
<!-- the boolean expression used to combine the query terms in this group -->
45
<!ATTLIST querygroup booleantype (AND|OR) #REQUIRED>
46

  
47
<!-- a query term is the atomic unit of a query that can be translated
48
     to a single SELECT statement -->
49
<!ELEMENT queryterm (value, pathexpr?)>
50

  
51
<!-- a boolean flag indicating whether matches should be case-sensitive or
52
     case-independent for this queryterm, one of: true|false -->
53
<!ATTLIST queryterm casesensitive (true|false) #REQUIRED "false">
54

  
55
<!-- the type of match to perform against the text value -->
56
<!ATTLIST queryterm searchmode 
57
          (contains|starts-with|ends-with|matches-exactly) #REQUIRED "contains">
58

  
59
<!-- the text value for which we are searching -->
60
<!ELEMENT value (#PCDATA)>
61

  
62
<!-- the path to the TEXT node used to constrain the query -->
63
<!ELEMENT pathexpr (#PCDATA)>
64

  
65
<!-- End of file -->
0 66

  

Also available in: Unified diff