AppSchemaDataAccess.xsd 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <schema xmlns="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://www.geotools.org/app-schema"
  3. xmlns:as="http://www.geotools.org/app-schema" xmlns:ogc="http://www.opengis.net/ogc"
  4. xmlns:gml="http://www.opengis.net/gml">
  5. <import namespace="http://www.opengis.net/ogc" schemaLocation="http://schemas.opengis.net/filter/1.1.0/expr.xsd" />
  6. <import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/feature.xsd" />
  7. <element name="AppSchemaDataAccess" type="as:AppSchemaDataAccessType">
  8. <annotation>
  9. <documentation>Root element of a mappings configuration file.</documentation>
  10. </annotation>
  11. </element>
  12. <complexType name="AppSchemaDataAccessType">
  13. <annotation>
  14. <documentation>
  15. Mappings configuration element type. Defines the mappings sections needed to define the namespaces _used in the
  16. config file instance_, the datastores with the source feature types, the schema location for the target feature
  17. types and the correspondence between both as mapping elements.
  18. </documentation>
  19. </annotation>
  20. <sequence>
  21. <element name="namespaces" type="as:NamespacesPropertyType" />
  22. <element name="includedTypes" type="as:IncludesPropertyType" minOccurs="0" />
  23. <element name="sourceDataStores" type="as:SourceDataStoresPropertyType" />
  24. <element name="catalog" type="string" minOccurs="0">
  25. <annotation>
  26. <documentation>
  27. If present, the location of an OASIS catalog file that shall be used
  28. to resolve the community schemas. The path can be relative to the
  29. configuration document which validates against this schema, or well
  30. an absolute URI.
  31. </documentation>
  32. </annotation>
  33. </element>
  34. <element name="targetTypes" type="as:TargetTypesPropertyType" />
  35. <element name="typeMappings" type="as:TypeMappingsPropertyType" />
  36. </sequence>
  37. </complexType>
  38. <complexType name="NamespacesPropertyType">
  39. <annotation>
  40. <documentation>
  41. <![CDATA[
  42. Use this element _only_ if you're going to do polymorphic mappings. You don't need to
  43. specify each and every namespace used in the community schemas in this section, since they'll
  44. be loaded by the schema parser.
  45. Thus, this section is just needed at the mappings configuration parsing stage, and only if you
  46. need complex datastore to assign a feature property which is not of the specific type stated
  47. in the schema for that property, but of a derivate type.
  48. For example, if you have:
  49. <xs:complexType name="MyFeatureType">
  50. <xs:complexContent>
  51. <xs:extension base="gml:AbstractFeatureType">
  52. <xs:sequence>
  53. <xs:element name="station" type="myns:MyBaseType"/>
  54. </xs:sequence>
  55. </xs:extension>
  56. </xs:complexContent>
  57. </xs:complexType>
  58. Now, say that myns:MyBaseType is abstract and at runtime you want that MyFeatureType instances
  59. being assigned an instance of myns2:MyDerivedType, which extends myns:MyBaseType.
  60. If you don't specify that situation in the mappings config file, complex datastore will have no
  61. way of inferring that, so the way of telling complex datastore to create an instance of
  62. myns2:MyDerivedType instead of the one declared in the schema, is by using a
  63. <targetElement>myns2:MyDerivedType</targetElement> tag in the attribute mapping (see
  64. TypeMappingsPropertyType documentation below).
  65. So, for the mappings parser to recognize which type the instance should actually be, you
  66. need to declare the namespace here, as well as in the actual xsd schema.
  67. ]]>
  68. </documentation>
  69. </annotation>
  70. <sequence>
  71. <element name="Namespace" minOccurs="0" maxOccurs="unbounded">
  72. <complexType>
  73. <sequence>
  74. <element name="prefix" type="string" />
  75. <element name="uri" type="string" />
  76. </sequence>
  77. </complexType>
  78. </element>
  79. </sequence>
  80. </complexType>
  81. <complexType name="IncludesPropertyType">
  82. <annotation>
  83. <documentation>
  84. <![CDATA[
  85. This is only needed if this type has related types that do not have their own
  86. Geoserver configuration, ie. not published in Geoserver. The type might be
  87. mapped separately so they can be reusable (feature chaining concept), e.g.
  88. If feature type A contains data type B, and feature type C also contains
  89. data type B, we only want to have one mapping file for data type B.
  90. The purpose of this is so that the parent type (this mapping) can find the
  91. related features.
  92. The type might not be visible on their own because it's not a feature type
  93. (e.g. a data type), therefore shouldn't appear in requests such as GetCapabilities,
  94. DescribeFeatureType etc.
  95. ]]>
  96. </documentation>
  97. </annotation>
  98. <sequence>
  99. <element name="Include" minOccurs="0" maxOccurs="unbounded" />
  100. </sequence>
  101. </complexType>
  102. <complexType name="SourceDataStoresPropertyType">
  103. <annotation>
  104. <documentation>
  105. <![CDATA[
  106. Used to reference the origin datastores containing the source feature types, aka the
  107. ones that are to be mapped to the community schemas.
  108. A unique id has to be assigned for each source datastore, as well as all the required
  109. datastore factory parameters in order to allow complex datastore to find them through
  110. the DataStoreFactorySpi mechanism.
  111. ]]>
  112. </documentation>
  113. </annotation>
  114. <sequence>
  115. <element name="DataStore" minOccurs="0" maxOccurs="unbounded">
  116. <complexType>
  117. <sequence>
  118. <element name="id" type="string" />
  119. <element name="parameters">
  120. <complexType>
  121. <sequence>
  122. <element name="Parameter" minOccurs="0" maxOccurs="unbounded">
  123. <complexType>
  124. <sequence>
  125. <element name="name" type="string" />
  126. <element name="value" type="string" />
  127. </sequence>
  128. </complexType>
  129. </element>
  130. </sequence>
  131. </complexType>
  132. </element>
  133. </sequence>
  134. <attribute name="id" type="ID" />
  135. </complexType>
  136. </element>
  137. </sequence>
  138. </complexType>
  139. <complexType name="TargetTypesPropertyType">
  140. <annotation>
  141. <documentation>
  142. <![CDATA[
  143. Here you have to specify lo location of the different xsd schema files that comprises
  144. the community schema. You have to specify each and every involved/relevant xsd schema
  145. since the current schema parser does not has the ability of following includes and imports.
  146. Also, it would be very helpful if they're declared in the more sequential fashion possible, since
  147. even if the schema parser uses proxied types when it finds a type reference that haven't still
  148. been loaded, setting schema file locations in random order could lead to missing referencing
  149. of nested types and thus causing an unrecoverable parsing time error.
  150. As for supported GML 3.1.1 types, complex datastore automatically loads the following gml schema files
  151. before parsing the community schemas, so if you need more gml types just add them prior to your
  152. own schemas:
  153. basicTypes.xsd
  154. gmlBase.xsd
  155. dictionary.xsd
  156. valueObjects.xsd
  157. coverage.xsd
  158. measures.xsd
  159. geometryBasic0d1d.xsd
  160. Note that though not all the geometry schemas are loaded, you don't need to import the corresponding
  161. gml schemas for geometry types since (at least for SFS) they're already supported by the geotools type system.
  162. ]]>
  163. </documentation>
  164. </annotation>
  165. <sequence>
  166. <element name="FeatureType" minOccurs="0" maxOccurs="1">
  167. <complexType>
  168. <sequence>
  169. <element name="schemaUri" type="string" minOccurs="0" maxOccurs="unbounded" />
  170. </sequence>
  171. </complexType>
  172. </element>
  173. </sequence>
  174. </complexType>
  175. <complexType name="TypeMappingsPropertyType">
  176. <annotation>
  177. <documentation>
  178. <![CDATA[
  179. This is where tha magis happens. The prior sections were just support information for getting
  180. to this instance. Inside this section, you have to declare one FeatureTypeMapping element
  181. for each feature type you want to map from an internal structure to the community schema.
  182. The FeatureTypeMapping element contains information as what is the internat feature type
  183. you want to map (given by the datastore id and feature type name), the name of the target
  184. element in the community schema you want to serve, and the attribute mappings between them.
  185. ]]>
  186. </documentation>
  187. </annotation>
  188. <sequence>
  189. <element name="FeatureTypeMapping" minOccurs="0" maxOccurs="unbounded">
  190. <complexType>
  191. <sequence>
  192. <element name="mappingName" type="string" minOccurs="0"/>
  193. <element name="sourceDataStore" type="string">
  194. <annotation>
  195. <documentation>one of the datastore ids defined in the sourceDataStores section</documentation>
  196. </annotation>
  197. </element>
  198. <element name="sourceType" type="string">
  199. <annotation>
  200. <documentation>
  201. the feature type name inside sourceDataStore to be mapped to the community schema
  202. </documentation>
  203. </annotation>
  204. </element>
  205. <element name="targetElement" type="string">
  206. <annotation>
  207. <documentation>
  208. the target element type. Note that this has to be an element type and not a feature type. Thus, the
  209. referenced element has to be of the desired feature type (for example, xmml:Borehole instead of
  210. xmml:BoreHoleType)
  211. </documentation>
  212. </annotation>
  213. </element>
  214. <element name="itemXpath" type="string" minOccurs="0">
  215. <annotation>
  216. <documentation>
  217. The xpath that identifies separate features in the xml returned from an xml datastore.
  218. </documentation>
  219. </annotation>
  220. </element>
  221. <element name="isXmlDataStore" type="boolean" default="false" minOccurs="0">
  222. <annotation>
  223. <documentation>
  224. <![CDATA[
  225. Flag to indicate that we want to connect to an xml data source]]>
  226. </documentation>
  227. </annotation>
  228. </element>
  229. <element name="isDenormalised" type="boolean" default="true" minOccurs="0">
  230. <annotation>
  231. <documentation>
  232. <![CDATA[
  233. Flag to indicate if the data is denormalised or not. If data is not denormalised
  234. (flag = false) then its safe for us to apply the system configured maxFeatures
  235. value when building the SQL query to run ]]>
  236. </documentation>
  237. </annotation>
  238. </element>
  239. <element name="attributeMappings" minOccurs="0">
  240. <annotation>
  241. <documentation>
  242. <![CDATA[
  243. Now it is time to map every target attribute with an expression from the source feature type. Generally,
  244. you only have to specify attribute mappings for those target attributes that are "leaf", aka, simlpe properties.
  245. The exception is when you have a multivalued complex attribute, in which case you have to create
  246. an AttributeMapping for the attribute to tell complex datastore to create as many instances of that
  247. complex attribute as source features fits the current "group" of a joined result.
  248. See the documentation for SingleMappingType and AttributeMappingType to lear what the structure of
  249. an attribute mapping is.
  250. Examples:
  251. --------------
  252. The simplest possible mapping, maps the source attribute BGS_ID to the name attribute of Borehole
  253. <AttributeMapping>
  254. <targetAttribute>Borehole/name</targetAttribute>
  255. <sourceExpression><OCQL>BGS_ID</OCQL></sourceExpression>
  256. </AttributeMapping>
  257. --------------
  258. Uses a function expression to map the result to the second instance of the name attribute.
  259. Also adds a "client property" named "codeSpace" with a fixed value. This leads to
  260. an xml attribute at GML encoding time.
  261. <AttributeMapping>
  262. <targetAttribute>Borehole/name[2]</targetAttribute>
  263. <sourceExpression><OCQL>strConcat(BGS_ID, 'name-#')</OCQL></sourceExpression>
  264. <ClientProperty>
  265. <name>codeSpace</name><value>"http://ns.bgs.ac.uk/bgs.ubi.pk"</value>
  266. </ClientProperty>
  267. </AttributeMapping>
  268. --------------
  269. Tells complex datastore to create an instance of range for each "row" of the same "group" of a
  270. joined result for a joined source feature type. No need to set sourceExpression since "range"
  271. attribute is complex and thus will have to set the mappings for its childs anyways.
  272. NOTE in this case we ommited "Borehole/" on the targetAttribute content. It is intentional, as
  273. and it should work both ways, as the filter encoding spec says that the root element name is
  274. optional.
  275. <AttributeMapping>
  276. <targetAttribute>log/IntervalLog/range</targetAttribute>
  277. <isMultiple>true</isMultiple>
  278. </AttributeMapping>
  279. ]]>
  280. </documentation>
  281. </annotation>
  282. <complexType>
  283. <sequence>
  284. <element name="AttributeMapping" minOccurs="0" maxOccurs="unbounded" type="as:AttributeMappingType" />
  285. </sequence>
  286. </complexType>
  287. </element>
  288. </sequence>
  289. </complexType>
  290. </element>
  291. </sequence>
  292. </complexType>
  293. <complexType name="AttributeExpressionMappingType">
  294. <annotation>
  295. <documentation>
  296. <![CDATA[
  297. Allows to specify the OGC's Common Query Language expression to be used
  298. as the source for a community schema element's content.
  299. ]]>
  300. </documentation>
  301. </annotation>
  302. <sequence>
  303. <choice minOccurs="0">
  304. <sequence>
  305. <element name="OCQL" type="string" />
  306. <element name="index" type="string" minOccurs="0" maxOccurs="1">
  307. <annotation>
  308. <documentation>
  309. <![CDATA[ The index of database row if denormalised. Example of usage is timeseries endPosition that reflects the last timePosition where the timePosition value is dynamic. ]]>
  310. </documentation>
  311. </annotation>
  312. </element>
  313. </sequence>
  314. <element name="Expression">
  315. <complexType>
  316. <sequence>
  317. <element ref="ogc:expression" />
  318. </sequence>
  319. </complexType>
  320. </element>
  321. <element name="inputAttribute" type="string">
  322. <annotation>
  323. <documentation>
  324. <![CDATA[ XPath expression addressing the input schema element this attribute mapping refers to ]]>
  325. </documentation>
  326. </annotation>
  327. </element>
  328. </choice>
  329. <element name="linkElement" type="string" minOccurs="0" maxOccurs="1">
  330. <annotation>
  331. <documentation>
  332. <![CDATA[ XPath expression addressing the target schema element this attribute mapping is nesting ]]>
  333. </documentation>
  334. </annotation>
  335. </element>
  336. <element name="linkField" type="string" minOccurs="0" maxOccurs="1">
  337. <annotation>
  338. <documentation>
  339. <![CDATA[ XPath expression addressing the target attribute this attribute mapping links to ]]>
  340. </documentation>
  341. </annotation>
  342. </element>
  343. </sequence>
  344. </complexType>
  345. <complexType name="AttributeMappingType">
  346. <annotation>
  347. <documentation>
  348. <![CDATA[
  349. Allows to specify the OGC's Common Query Language expression to be used
  350. as the source for a community schema element's content, as long as wether
  351. it is a multivalued property, which target schema element should be created
  352. instead of the default declared on the target schema, and any number
  353. of client properties (aka, xml element attributes)
  354. ]]>
  355. </documentation>
  356. </annotation>
  357. <sequence>
  358. <element name="label" type="string" minOccurs="0">
  359. <annotation>
  360. <documentation>
  361. <![CDATA[ Name by which other attributes can uniquely refer to this attribute. (Used in xml datastores.) ]]>
  362. </documentation>
  363. </annotation>
  364. </element>
  365. <element name="parentLabel" type="string" minOccurs="0" >
  366. <annotation>
  367. <documentation>
  368. <![CDATA[ A reference to another attribute which has a label tag. The parentLabel has the name contained in the other attributes label tag. (Used in xml datastores.) ]]>
  369. </documentation>
  370. </annotation>
  371. </element>
  372. <element name="targetAttribute" type="string">
  373. <annotation>
  374. <documentation>
  375. <![CDATA[ XPath expression addressing the target schema element this attribute mapping refers to ]]>
  376. </documentation>
  377. </annotation>
  378. </element>
  379. <element name="targetQueryString" type="string" minOccurs="0">
  380. <annotation>
  381. <documentation>
  382. <![CDATA[ Used to translate a reference to an attribute in an incoming filter to the element used in an xml datastore.]]>
  383. </documentation>
  384. </annotation>
  385. </element>
  386. <element name="idExpression" minOccurs="0" type="as:AttributeExpressionMappingType">
  387. <annotation>
  388. <documentation>
  389. <![CDATA[ CQL expression whose evaluated value over the Features of the
  390. surrogate datastore is to be usedas the ID value for the target schema
  391. attribute this AttributeMapping refers to ]]>
  392. </documentation>
  393. </annotation>
  394. </element>
  395. <element name="sourceExpression" minOccurs="0" type="as:AttributeExpressionMappingType">
  396. <annotation>
  397. <documentation>
  398. <![CDATA[ CQL Expression whose evaluated value over the Feature(s) of the
  399. surrogate datastore is to be used as the value for the target schema attribute
  400. this AttributeMapping refers to ]]>
  401. </documentation>
  402. </annotation>
  403. </element>
  404. <element name="instancePath" type="string" minOccurs="0">
  405. <annotation>
  406. <documentation>
  407. <![CDATA[ When counting how many complex types to create in a label/parentlabel tree, this is the path to use to count instances in the input data. ]]>
  408. </documentation>
  409. </annotation>
  410. </element>
  411. <element name="targetAttributeNode" type="string" minOccurs="0">
  412. <annotation>
  413. <documentation>
  414. <![CDATA[ name of a top level element declaration in the target schema which has to be instantiated
  415. when creating this attribute instead of the one declared in the target schema. This is to support
  416. the cases where the schema states a given element, which might be abstract, and we want an specific
  417. kind of element to be used, which should be in the schema's declared element substitution group
  418. according to the GML rules, though AppSchemaDataAccess will not check for it. ]]>
  419. </documentation>
  420. </annotation>
  421. </element>
  422. <element name="isMultiple" type="boolean" default="false" minOccurs="0">
  423. <annotation>
  424. <documentation>
  425. <![CDATA[ Flag to indicate the target element addressed by this mapping has to be treated as
  426. a multivalued property. AppSchemaDataAccess will treat all the attribute mappings having this flag
  427. set to true as multivalued attributes and will create as many instances of it as Features of
  428. the surrogate datastore lie inside the FeatureTypeMapping ]]>
  429. </documentation>
  430. </annotation>
  431. </element>
  432. <element name="encodeIfEmpty" type="boolean" default="false" minOccurs="0">
  433. <annotation>
  434. <documentation>
  435. <![CDATA[ Flag to determine whether to skip a attribute mapping if it is empty default to false]]>
  436. </documentation>
  437. </annotation>
  438. </element>
  439. <element name="isList" type="boolean" default="false" minOccurs="0">
  440. <annotation>
  441. <documentation>
  442. <![CDATA[ Flag to indicate the target element addressed by this mapping has to be treated as
  443. a container of a list of values. This is similar to isMultiple except the values are concatenated
  444. as one big value instead of multiple elements with each value.]]>
  445. </documentation>
  446. </annotation>
  447. </element>
  448. <element name="ClientProperty" minOccurs="0" maxOccurs="unbounded">
  449. <complexType>
  450. <sequence>
  451. <element name="name" type="string">
  452. <annotation>
  453. <documentation>name of the client property/xml element attribute</documentation>
  454. </annotation>
  455. </element>
  456. <element name="value" type="string">
  457. <annotation>
  458. <documentation>OGC CQL expression for the attribute value</documentation>
  459. </annotation>
  460. </element>
  461. </sequence>
  462. </complexType>
  463. </element>
  464. </sequence>
  465. </complexType>
  466. </schema>