zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #26427
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba.
Commit message:
New JSound validator.
Requested reviews:
Paul J. Lucas (paul-lucas)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-jsoniqpp/+merge/197991
New JSound validator.
--
https://code.launchpad.net/~zorba-coders/zorba/feature-jsoniqpp/+merge/197991
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/internal/pregenerated/qnames.h'
--- include/zorba/internal/pregenerated/qnames.h 2013-10-15 23:27:57 +0000
+++ include/zorba/internal/pregenerated/qnames.h 2013-12-06 05:12:46 +0000
@@ -48,6 +48,17 @@
zorba::diagnostic::kind kind() const;
};
+class ZORBA_DLL_PUBLIC JSoundErrorQName :
+ public FixedQName<JSoundErrorQName,char const*>
+{
+ typedef FixedQName<JSoundErrorQName,char const*> base_type;
+public:
+ static char const NAMESPACE[];
+ static char const PREFIX[];
+ JSoundErrorQName( char const *localname ) : base_type( localname ) { }
+ zorba::diagnostic::kind kind() const;
+};
+
class ZORBA_DLL_PUBLIC ZorbaErrorQName :
public FixedQName<ZorbaErrorQName,char const*>
{
@@ -107,6 +118,7 @@
typedef internal::SystemDiagnostic<internal::XQueryErrorQName> XQueryErrorCode;
typedef internal::SystemDiagnostic<internal::JSONiqErrorQName> JSONiqErrorCode;
+typedef internal::SystemDiagnostic<internal::JSoundErrorQName> JSoundErrorCode;
typedef internal::SystemDiagnostic<internal::ZorbaErrorQName> ZorbaErrorCode;
typedef internal::SystemDiagnostic<internal::ZorbaWarningQName> ZorbaWarningCode;
typedef internal::SystemDiagnostic<internal::ZorbaCSVErrorQName> ZorbaCSVErrorCode;
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h 2013-10-15 23:27:57 +0000
+++ include/zorba/pregenerated/diagnostic_list.h 2013-12-06 05:12:46 +0000
@@ -931,6 +931,48 @@
} // namespace jerr
+namespace jsd {
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode DUPLICATE_PREFIX;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode DUPLICATE_TYPE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_ARRAY_SIZE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_BASE_TYPE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_FACET;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_FACET_VALUE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_KEY;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_NAMESPACE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_PREFIX;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_SCHEMA;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode ILLEGAL_TYPE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode MISSING_KEY;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode NEW_KEY_NOT_ALLOWED;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode SCHEMA_NOT_FOUND;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode TYPE_MISMATCH;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode UNKNOWN_PREFIX;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode UNKNOWN_TYPE;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode FACET_VIOLATION;
+
+extern ZORBA_DLL_PUBLIC JSoundErrorCode TYPE_VIOLATION;
+
+} // namespace jsd
+
namespace zwarn {
extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0002_UNKNOWN_ANNOTATION;
=== modified file 'modules/jsound/CMakeLists.txt'
--- modules/jsound/CMakeLists.txt 2013-08-31 16:22:59 +0000
+++ modules/jsound/CMakeLists.txt 2013-12-06 05:12:46 +0000
@@ -13,7 +13,7 @@
# limitations under the License.
DECLARE_ZORBA_MODULE(FILE jsound.jq VERSION 1.0
- URI "http://jsound.io/modules/validate")
+ URI "http://jsound.io/modules/jsound")
DECLARE_ZORBA_MODULE(FILE map.jq VERSION 1.0
URI "http://jsound.io/modules/validate/map")
=== modified file 'modules/jsound/jsound.jq'
--- modules/jsound/jsound.jq 2013-10-16 21:47:22 +0000
+++ modules/jsound/jsound.jq 2013-12-06 05:12:46 +0000
@@ -1,6 +1,5 @@
jsoniq version "1.0";
-
(:
: Copyright 2006-2013 The FLWOR Foundation.
:
@@ -18,676 +17,80 @@
:)
(:~
- : JSound simple validator.
- : This is a JSONiq implemenation of the JSound (the schema for JSON) validator.
+ : JSound (JSON schema) validator.
:
- : @author Cezar Andrei
+ : @author Paul J. Lucas
:)
-module namespace jsv = "http://jsound.io/modules/validate";
+module namespace jsd = "http://jsound.io/modules/jsound";
-import module namespace jn = "http://jsoniq.org/functions";
-import module namespace map = "http://jsound.io/modules/validate/map";
import module namespace fetch = "http://zorba.io/modules/fetch";
-declare namespace an = "http://zorba.io/annotations";
declare namespace ver = "http://zorba.io/options/versioning";
declare option ver:module-version "1.0";
-(:~
- : Validates the $instance JSON item against the JSound type with name $name
- : and namespace $ns, from the JSound schema definition $jsd.
- :
- : @param $ns the namespace of the expected type
- : @param $name the name of the expected type
- : @param $instance the instance to be validated
- : @return true if the instance is valid, otherwise throws an error.
- : @error jsv:BadJSoundFormat If the schema is not a valid JSound schema
- : @error jsv:Invalid If the instance does not conform to the JSound schema
- : @error zerr:ZXQP0025 If the schema namespace URI cannot be resolved.
- : @error jn:JNDY0021 If the loaded schema is syntactically incorrect
- :)
-declare %an:sequential function
-jsv:jsd-valid($ns as string, $name as string, $instance as json-item)
- as boolean
-{
- let $schemadoc := fetch:content($ns, "SCHEMA")
- let $jsd := jn:parse-json($schemadoc)
- return jsv:jsd-valid($jsd, $name, $ns, $instance)
-};
-
-
-(:~
- : Validates the $instance JSON item against the JSound type with name $name
- : and namespace $ns, from the JSound schema definition $jsd.
- :
- : @param $jsd the JSound schema as a JSON object to be validated against
- : @param $name the name of the expected type
- : @param $ns the namespace of the expected type
- : @param $instance the instance to be validated
- : @return true if the instance is valid, otherwise throws an error.
- : @error jsv:BadJSoundFormat If the schema is not a valid JSound schema
- : @error jsv:Invalid If the instance does not conform to the JSound schema
-<code>
- import module namespace jsv = "http://jsound.io/modules/validate";
-
- let $jsd :=
- {
- "$namespace" : "http://zorba.io/modules/images/",
- "$types" : [
- {
- "$name" : "line",
- "$kind" : "object",
- "$content" :
- {
- "start" :
- {
- "$type" : "integer"
- },
- "end" :
- {
- "$type" : "integer"
- }
- }
- }
- ]
- }
-
- let $instance :=
- {
- "start": 1,
- "end": 5
- }
- return
- jsv:jsd-valid($jsd, "line", "http://zorba.io/modules/images/", $instance)
-</code>
- :)
-declare %an:sequential function
-jsv:jsd-valid($jsd as object, $name as string, $ns as string,
- $instance as item) as boolean
-{
- variable $jstypes := { "foo" : 5 };
-
- switch( false )
- case $jsd instance of object
- return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "The specified JSON document is not a valid JSound schema: top item not an object.");
-
- case exists($jsd("$namespace")) and exists($jsd("$types"))
- return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: must contain '$types' and '$namespace' keys.");
-
- case $jsd("$namespace") instance of string
- return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: value of '$namespace' must be a string.");
-
- case $jsd("$namespace") eq $ns
- return
- fn:error(QName("jsv", "Invalid"),
- "Requested type namespace not matching schema document namespace.");
-
- case $jsd("$types") instance of array
- return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: value of '$types' must be an array.");
-
- default
- return
- jsv:check-types( $jstypes, $jsd("$types") );
-
- (: todo: validate all type refs :)
-
- jsv:validate-instance($jstypes, $name, $instance)
-};
-
-
-(: The check-xxx functions just checks if the JSound schema definitions are valid. :)
-
-declare %private %an:sequential function
-jsv:check-types($jstypes as object, $types as array) as boolean
-{
- every $i in
- for $type in jn:members($types)
- return
- jsv:check-type($jstypes, $type )
- satisfies $i eq true
-};
-
-
-declare %private %an:sequential function
-jsv:check-type($jstypes as object, $type as item) as boolean
-{
- if( $type instance of object )
- then
- if ( exists($type("$kind")) and $type("$kind") instance of string )
- then
- switch( $type("$kind") )
- case "atomic" return jsv:check-atomic-type($jstypes, $type)
- case "object" return jsv:check-object-type($jstypes, $type)
- case "array" return jsv:check-array-type ($jstypes, $type)
- case "union" return jsv:check-union-type ($jstypes, $type)
-
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: type $kind unknown:" || $type("$kind") )
-
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: type definition must contain '$kind' key with string value.")
- else
- if( $type instance of string )
- then
- jsv:check-ref-type($jstypes, $type)
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: type item not an object." )
-};
-
-
-declare %private %an:sequential function
-jsv:check-atomic-type($jstypes as object, $type as object) as boolean
-{
- (: fn:trace( $type("$name"), "check-atomic-type"); :)
-
- if( exists($type("$baseType")) and $type("$baseType") instance of string )
- then
- jsv:save-type($jstypes, $type)
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: atomic type definition must contain '$baseType' key with string value.")
-
- (: todo: add facets checks: length, min/max Inclusive/Exclusive, etc. :)
-};
-
-
-declare %private %an:sequential function
-jsv:check-object-type($jstypes as object, $type as object) as boolean
-{
- (: todo: check the reast of "object" type :)
- jsv:save-type($jstypes, $type);
- (: fn:trace( $type("$name"), "check-object-type"); :)
-
- if( exists($type("$content")) )
- then
- if( $type("$content") instance of object )
- then
- every $i in
- for $k in jn:keys($type("$content"))
- return
- if( $type("$content")($k) instance of object )
- then
- if( exists( $type("$content")($k)("$type")) )
- then
- jsv:check-type($jstypes, $type("$content")($k)("$type") )
- else
- if( exists( $type("$content")($k)("$kind")) )
- then
- jsv:check-type($jstypes, $type("$content")($k) )
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: Key does not contain a $type definition.")
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: Key " || $k || " in $content must have an object value.")
-
- satisfies $i eq true
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: $content definion of object type must be an object.")
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: Object type does not contain $content.")
-};
-
-
-declare %private %an:sequential function
-jsv:check-array-type($jstypes as object, $type as object) as boolean
-{
- (: fn:trace( $type("$name"), "check-array-type"); :)
-
- (: check all the contents :)
- let $content := $type("$content")
- let $checkContent :=
- if( empty($content) )
- then
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: $kind array must have a $content key.")
- else
- if( $content instance of array and jn:size($content) eq 1 )
- then
- {
- jsv:save-type($jstypes, $type);
-
- typeswitch( $content(1) )
- case string return
- true
- case object return
- jsv:check-type($jstypes, $content(1))
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind array, $content[1] must be string or array.")
- }
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind array, $content must be an array of size 1.")
-
- let $checkMinLength :=
- if( fn:exists($type("$minLength")) )
- then
- if( $type("$minLength") instance of integer )
- then true
- else fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind array, $minLength must be an integer.")
- else true
-
- let $checkMaxLength :=
- if( fn:exists($type("$maxLength")) )
- then
- if( $type("$maxLength") instance of integer )
- then true
- else fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind array, $maxLength must be an integer.")
- else true
-
- return
- $checkContent and $checkMinLength and $checkMaxLength
-};
-
-
-declare %private %an:sequential function
-jsv:check-union-type($jstypes as object, $type as object) as boolean
-{
- (: fn:trace( $type("$name"), "check-union-type"); :)
-
- let $content := $type("$content")
- return
- if( empty($content) )
- then
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: $kind union must have a $content key.")
- else
- if( $content instance of array )
- then
- {
- jsv:save-type($jstypes, $type);
-
- every $i in
- for $c in jn:members($content)
- return
- typeswitch( $c )
- case string return
- true
- case object return
- jsv:check-type($jstypes, $c)
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind union, $content items must be strings or objects.")
- satisfies $i eq true
- }
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind union, $content must be an array.")
-};
-
-
-declare %private function
-jsv:check-ref-type($jstypes as object, $type as string) as boolean
-{
- switch( $type )
- case "string" return true
- case "integer" return true
- case "boolean" return true
- case "anyURI" return true
- default return
- {
- if( map:has-key($jstypes, $type) )
- then
- true
- else
- (: todo: save all refs, check them at the end to see if they exist :)
- true
- }
-
- (: todo: apply resolution rules :)
-};
-
-
-declare %private %an:sequential function
-jsv:save-type($jstypes as object, $type as item) as boolean
-{
- switch( false )
- case fn:exists( $type("$name") )
- return false
- case $type("$name") instance of string
- return fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $type, $name must be a string.")
- case map:set-if-empty($jstypes, $type("$name"), $type)
- return fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: type '" || $type("$name") || "' already defined.")
- default return true()
-};
-
-
-
-
-
-(: The validate-xxx functions actualy do the validation of the instance :)
-
-
-declare %private function
-jsv:validate-instance($jstypes as object, $name as string, $instance as item)
- as boolean
-{
- let $type := map:get($jstypes, $name)
- return
- if( exists($type) )
- then
- jsv:validate-type($jstypes, $type, $instance)
- else
- fn:error(QName("jsv", "Invalid"),
- "Requested type name not present in schema: " || $name)
-};
-
-
-declare %private function
-jsv:validate-type($jstypes as object, $type as item, $instance as item) as boolean
-{
- switch( $type("$kind") )
- case "atomic" return jsv:validate-atomic-type($jstypes, $type, $instance)
- case "object" return jsv:validate-object-type($jstypes, $type, $instance)
- case "array" return jsv:validate-array-type($jstypes, $type, $instance)
- case "union" return jsv:validate-union-type($jstypes, $type, $instance)
-
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: type $kind unknown:" || $type("$kind") )
-};
-
-
-declare %private function
-jsv:validate-type-ref($jstypes as object, $type as string, $instance as item) as boolean
-{
- (: todo: check first between the defined types in $jstypes and then the build-in ones, this is per spec :)
-
- if( map:has-key($jstypes, $type) )
- then
- jsv:validate-type($jstypes, map:get($jstypes, $type), $instance)
- else
- switch( $type )
- case "string" return
- if ( $instance instance of string )
- then
- true
- else
- fn:error(QName("jsv", "Invalid"), "Expected string value.")
- case "integer" return
- if ( $instance instance of integer or
- $instance instance of int )
- then
- true
- else
- fn:error(QName("jsv", "Invalid"), "Expected integer value.")
- case "anyURI" return
- if ( $instance instance of anyURI )
- then
- true
- else
- fn:error(QName("jsv", "Invalid"), "Expected anyURI value.")
- case "boolean" return
- if ( $instance instance of boolean )
- then
- true
- else
- fn:error(QName("jsv", "Invalid"), "Expected boolean value.")
-
- default return
- fn:error(QName("jsv", "Invalid"),
- fn:concat("Type ref not defined or a built-in type: ", $type) )
-};
-
-
-declare %private function
-jsv:validate-atomic-type($jstypes as object, $type as object, $instance as item) as boolean
-{
- (: fn:trace( $type("$name"), "validate-atomic-type"); :)
- (: todo: check first between the defined types in $jstypes and then the build-in ones, this is per spec :)
-
- if ( exists($type("$baseType")) and $type("$baseType") instance of string )
- then
- switch( $type("$baseType") )
- case "integer" return
- if ( $instance instance of integer or $instance instance of int )
- then
- jsv:validate-enumeration($jstypes, $type, $instance)
- else
- fn:error(QName("jsv", "Invalid"), "Expected integer or int value")
-
- case "string" return
- if ( $instance instance of string )
- then
- jsv:validate-enumeration($jstypes, $type, $instance)
- else
- fn:error( QName("jsv", "Invalid"), "Expected string value")
-
- case "anyURI" return
- if ( $instance instance of anyURI )
- then
- jsv:validate-enumeration($jstypes, $type, $instance)
- else
- fn:error(QName("jsv", "Invalid"), "Expected anyURI value")
-
- case "boolean" return
- if ( $instance instance of boolean )
- then
- jsv:validate-enumeration($jstypes, $type, $instance)
- else
- fn:error(QName("jsv", "Invalid"), "Expected boolean value")
-
- default return
- fn:error(QName("jsv", "NYI"),
- "$baseType: not yet implemented" || $type("$baseType") )
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: atomic type definition must contain '$baseType' key with string value.")
-
- (: todo: add facets checks: length, min/max Inclusive/Exclusive, etc. :)
-};
-
-declare %private function
-jsv:validate-enumeration($jstypes as object, $type as object, $instance as item) as boolean
-{
- variable $enum := $type("$enumeration");
- if( exists($enum) )
- then
- if( $enum instance of array )
- then
- if( some $v in jn:members($enum) satisfies $v eq $instance )
- then
- true
- else
- fn:error(QName("jsv", "Invalid"), "Instance value not in the enumeration list.")
- else
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: the value of '$enumeration' must be an array.")
- else
- true
-};
-
-declare %private function
-jsv:validate-object-type($jstypes as object, $type as object, $instance as item) as boolean
-{
- (: fn:trace( $type("$name"), "validate-object-type"); :)
-
- variable $open := $type("$open");
-
- if ( $instance instance of object )
- then
- if( (not exists($open)) or (exists($open) and $open eq true()) )
- then
- (: object is open: i.e. extra keys alowed but all defined keys must be in
- the instance except the default and optional ones :)
- (
- every $k in jn:keys($instance)
- satisfies
- let $ctype := $type("$content")($k)("$type")
- return
- typeswitch( $ctype )
- case string return
- jsv:validate-type-ref($jstypes, $ctype, $instance($k) )
- case object return
- jsv:validate-type($jstypes, $ctype, $instance($k) )
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind object, $content $type must be string or array.")
- ) and
- (
- every $k in
- jsv:value-except(jn:keys($type("$content")), jn:keys($instance))
- satisfies
- let $optional := $type("$content")($k)("$optional")
- return
- if( exists($optional) and $optional eq true )
- then true
- else
- fn:error(QName("jsv", "Invalid"),
- fn:concat("Required key not present in instance: ", $k) )
- )
- else
- (: object is closed: i.e. all defined keys must be in the instance except
- the default ones, no extra keys alowed :)
- (
- every $k in jn:keys($instance)
- satisfies
- let $ctype := $type("$content")($k)("$type")
- return
- typeswitch( $ctype )
- case string return
- jsv:validate-type-ref($jstypes, $ctype, $instance($k) )
- case object return
- jsv:validate-type($jstypes, $ctype, $instance($k) )
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind object, $content $type must be string or array.")
- ) and (
- every $k in (: jn:keys($type("$content")) except jn:keys($instance) :)
- jsv:value-except(jn:keys($type("$content")), jn:keys($instance))
- satisfies
- let $optional := $type("$content")($k)("$optional")
- return
- if( exists($optional) and $optional eq true )
- then true
- else
- fn:error(QName("jsv", "Invalid"),
- fn:concat("Required key not present in instance: ", $k) )
- )
- else
- fn:error( QName("jsv", "Invalid"),
- fn:concat("Instance not an object specified by type: ", jsv:get-type-name($type)) )
-};
-
-declare %private function
-jsv:validate-array-type($jstypes as object, $type as object, $instance as item) as boolean
-{
- (: fn:trace( $type("$name"), "validate-array-type"); :)
-
- if( $instance instance of array )
- then
- (: check all the contents :)
- let $content := $type("$content")
- let $validateContent :=
- typeswitch( $content(1) )
- case string return
- every $i in jn:members($instance) satisfies jsv:validate-type-ref($jstypes, $content(1), $i)
- case object return
- every $i in jn:members($instance) satisfies jsv:validate-type($jstypes, $content(1), $i)
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind array, $content[1] must be string or array.")
- let $validateMinLength :=
- if( fn:exists($type("$minLength")) )
- then
- if ( $type("$minLength") le size($instance) )
- then true
- else fn:error(QName("jsv", "Invalid"),
- "Invalid array size, smaller then $minLength facet constraint.")
- else true
- let $validateMaxLength :=
- if( fn:exists($type("$maxLength")) )
- then
- if( $type("$maxLength") ge size($instance) )
- then true
- else fn:error(QName("jsv", "Invalid"),
- "Invalid array size, bigger than $maxLength facet constraint.")
- else true
- return
- $validateContent and $validateMinLength and $validateMaxLength
- else
- fn:error(QName("jsv", "Invalid"),
- fn:concat("Instance not an array for type: ", jsv:get-type-name($type)) )
-
- (: check array facets :)
-};
-
-
-declare %private function
-jsv:validate-union-type($jstypes as object, $type as object, $instance as item) as boolean
-{
- let $content := $type("$content")
- return
- if(
- some $i in
- for $c in jn:members($content)
- return
- try
- {
- typeswitch( $c )
- case string return
- true
- case object return
- jsv:validate-type($jstypes, $c, $instance)
- default return
- fn:error(QName("jsv", "BadJSoundFormat"),
- "Not a valid JSound doc: for $kind union, $content items must be strings or objects.")
- }
- catch Invalid
- {
- false
- }
- satisfies $i eq true
- )
- then true
- else
- fn:error(QName("jsv", "Invalid"),
- fn:concat("Instance not valid for union type: ", jsv:get-type-name($type)) )
-};
-
-
-(:---- Util functions ---------:)
-
-declare %private function
-jsv:get-type-name($type as object) as string
-{
- let $name := $type("$name")
- return
- if ( exists($name) and $name instance of string )
- then
- $name
- else
- "N/A"
-};
-
-
-declare %private function
-jsv:value-except($arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*)
- as xs:anyAtomicType*
-{
- (: fn:distinct-values( $arg1[ not($$ eq $arg2) ] ) :)
- fn:distinct-values(
- for $i in $arg1
- where not( some $x in $arg2 satisfies $i eq $x )
- return $i
- )
-};
+(:===========================================================================:)
+
+(:~
+ : Annotates the given JSON object against the given JSound schema type.
+ :
+ : @param $ns The namespace URI of the JSound schema to annotate against.
+ : @param $type-name The name of the type in the schema to annotate against.
+ : @param $item The JSON item to annotate.
+ : @return <code>true</code> only if <code>$item</code> is valid.
+ : @error TODO
+ :)
+declare function jsd:ns-annotate( $ns as string, $type-name as string,
+ $item as item )
+ as boolean
+{
+ let $schema_doc := fetch:content( $ns, "SCHEMA" )
+ let $jsd := jn:parse-json( $schema_doc )
+ return jsd:jsd-annotate( $jsd, $type-name, $item )
+};
+
+(:~
+ : Annotates the given JSON object against the given JSound schema type.
+ :
+ : @param $jsd The JSound schema to use.
+ : @param $type-name The name of the type in the schema to annotate against.
+ : @param $item The JSON item to annotate.
+ : @return the annotated JSON object.
+ :)
+declare function jsd:jsd-annotate( $jsd as object, $type-name as string,
+ $item as item )
+ as item external;
+
+(:~
+ : Validates the given JSON object against the given JSound schema type.
+ :
+ : @param $ns The namespace URI of the JSound schema to validate against.
+ : @param $type-name The name of the type in the schema to validate against.
+ : @param $item The JSON item to validate.
+ : @return <code>true</code> only if <code>$item</code> is valid.
+ : @error TODO
+ :)
+declare function jsd:ns-validate( $ns as string, $type-name as string,
+ $item as item )
+ as boolean
+{
+ let $schema_doc := fetch:content( $ns, "SCHEMA" )
+ let $jsd := jn:parse-json( $schema_doc )
+ return jsd:jsd-validate( $jsd, $type-name, $item )
+};
+
+(:~
+ : Validates the given JSON object against the given JSound schema type.
+ :
+ : @param $jsd The JSound schema to validate against.
+ : @param $type-name The name of the type in the schema to validate against.
+ : @param $item The JSON item to validate.
+ : @return <code>true</code> only if <code>$item</code> is valid.
+ :)
+declare function jsd:jsd-validate( $jsd as object, $type-name as string,
+ $item as item )
+ as boolean external;
+
+(:===========================================================================:)
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== modified file 'src/compiler/api/compilercb.cpp'
--- src/compiler/api/compilercb.cpp 2013-05-15 10:58:40 +0000
+++ src/compiler/api/compilercb.cpp 2013-12-06 05:12:46 +0000
@@ -186,7 +186,6 @@
CompilerCB::~CompilerCB()
{
delete theEM;
- theSctxMap.clear();
}
=== modified file 'src/context/default_uri_mappers.cpp'
--- src/context/default_uri_mappers.cpp 2013-10-11 19:41:41 +0000
+++ src/context/default_uri_mappers.cpp 2013-12-06 05:12:46 +0000
@@ -74,7 +74,7 @@
// host is to work around a possibly bogus FOTS test module-URIs-19.
lPath.append("/");
}
- if (ascii::ends_with(lPath, "/")) {
+ if (ZA_ENDS_WITH(lPath, "/")) {
// If URI's path component ends with /, append "index.<extension>".
lPath.append("index");
lPath.append(lExtension);
@@ -118,7 +118,7 @@
// Ensure that the namespace URI ends in ".module", and then strip it.
zstring const lBaseUri = lModVer.namespace_uri();
- if ( ! ascii::ends_with(lBaseUri, ".module")) {
+ if ( ! ZA_ENDS_WITH(lBaseUri, ".module")) {
return;
}
zstring const lRootUri = lBaseUri.substr(0, lBaseUri.size() - 7);
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2013-10-17 02:01:22 +0000
+++ src/context/static_context.cpp 2013-12-06 05:12:46 +0000
@@ -351,6 +351,9 @@
static_context::ZORBA_IO_NS_PREFIX = "http://zorba.io/";
const char*
+static_context::JSOUND_IO_NS_PREFIX = "http://jsound.io/";
+
+const char*
static_context::ZORBA_MATH_FN_NS =
"http://zorba.io/modules/math";
@@ -367,6 +370,10 @@
"http://zorba.io/modules/json-xml";
const char*
+static_context::ZORBA_JSOUND_FN_NS =
+"http://jsound.io/modules/jsound";
+
+const char*
static_context::ZORBA_REFERENCE_FN_NS =
"http://zorba.io/modules/reference";
@@ -536,7 +543,8 @@
bool static_context::is_builtin_module(const zstring& ns)
{
if (ns.compare(0, strlen(ZORBA_NS_PREFIX), ZORBA_NS_PREFIX) == 0 ||
- ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0)
+ ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0 ||
+ ns.compare(0, strlen(JSOUND_IO_NS_PREFIX), JSOUND_IO_NS_PREFIX) == 0)
{
return (ns == ZORBA_MATH_FN_NS ||
ns == ZORBA_BASE64_FN_NS ||
@@ -565,6 +573,7 @@
ns == ZORBA_JSON_CSV_FN_NS ||
ns == ZORBA_JSON_XML_FN_NS ||
+ ns == ZORBA_JSOUND_FN_NS ||
ns == ZORBA_FETCH_FN_NS ||
ns == ZORBA_NODE_FN_NS ||
ns == ZORBA_ITEM_FN_NS ||
@@ -622,11 +631,13 @@
bool static_context::is_non_pure_builtin_module(const zstring& ns)
{
if (ns.compare(0, strlen(ZORBA_NS_PREFIX), ZORBA_NS_PREFIX) == 0 ||
- ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0)
+ ns.compare(0, strlen(ZORBA_IO_NS_PREFIX), ZORBA_IO_NS_PREFIX) == 0 ||
+ ns.compare(0, strlen(JSOUND_IO_NS_PREFIX), JSOUND_IO_NS_PREFIX) == 0)
{
return (ns == ZORBA_MATH_FN_NS ||
ns == ZORBA_JSON_CSV_FN_NS ||
ns == ZORBA_JSON_XML_FN_NS ||
+ ns == ZORBA_JSOUND_FN_NS ||
ns == ZORBA_XQDOC_FN_NS ||
ns == ZORBA_URI_FN_NS ||
ns == ZORBA_RANDOM_FN_NS ||
@@ -1781,9 +1792,9 @@
// We should never try to load the http-client module using its original URI,
// because that URI starts with http:, so we'll try to load the http-client
// module, leading to a stack overflow.
- if (ascii::begins_with(*url, "http://zorba.io/modules/http-client")
+ if (ZA_BEGINS_WITH(*url, "http://zorba.io/modules/http-client")
||
- ascii::begins_with(*url, "http://www.zorba-xquery.com/modules/http-client"))
+ ZA_BEGINS_WITH(*url, "http://www.zorba-xquery.com/modules/http-client"))
{
continue;
}
=== modified file 'src/context/static_context.h'
--- src/context/static_context.h 2013-10-09 23:12:06 +0000
+++ src/context/static_context.h 2013-12-06 05:12:46 +0000
@@ -514,6 +514,7 @@
static const char* ZORBA_NS_PREFIX; // http://www.zorba-xquery.com/
static const char* ZORBA_IO_NS_PREFIX; // http://zorba.io/
+ static const char* JSOUND_IO_NS_PREFIX; // http://jsound.io/
// Namespaces of external modules declaring zorba builtin functions
static const char* ZORBA_MATH_FN_NS;
@@ -521,6 +522,7 @@
static const char* ZORBA_JSON_CSV_FN_NS;
static const char* ZORBA_JSON_XML_FN_NS;
+ static const char* ZORBA_JSOUND_FN_NS;
static const char* ZORBA_REFERENCE_FN_NS;
static const char* ZORBA_NODEPOS_FN_NS;
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2013-10-16 21:47:22 +0000
+++ src/diagnostics/diagnostic_en.xml 2013-12-06 05:12:46 +0000
@@ -3481,6 +3481,147 @@
</namespace>
+ <!--////////// JSound errors /////////////////////////////////////////////-->
+
+ <namespace prefix="jsd">
+
+ <diagnostic code="DUPLICATE_PREFIX">
+ <value>"$1": duplicate prefix</value>
+ </diagnostic>
+
+ <diagnostic code="DUPLICATE_TYPE">
+ <value>"$1": duplicate type name</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_ARRAY_SIZE">
+ <value>\$content facet must be array with exactly 1 element</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_BASE_TYPE">
+ <value>"$1": illegal base-type${ for "2"}$3</value>
+ <entry key="BecauseOfKey_45">
+ <value> because of key "$4": $5</value>
+ </entry>
+ <entry key="IncompatibleFacets_4">
+ <value>: incompatible facet values for "$4"</value>
+ </entry>
+ <entry key="MustBeX_4">
+ <value>: must be "$4"</value>
+ </entry>
+ <entry key="NotSubtype_45">
+ <value>: "$4" is not a subtype of "$5"</value>
+ </entry>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_FACET">
+ <value>"$1": illegal facet for $2</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_FACET_VALUE">
+ <value>"$1": illegal value for facet $2: $3</value>
+ <entry key="BadConstraint_45">
+ <value>[$4]: $5</value>
+ </entry>
+ <entry key="BadPattern_45">
+ <value>[$4]: $5</value>
+ </entry>
+ <entry key="IncompatibleWith_45">
+ <value>incompatible with $4 facet value of "$5"</value>
+ </entry>
+ <entry key="MustBeGE0">
+ <value>must be >= 0</value>
+ </entry>
+ <entry key="MustBeOPR">
+ <value>must be one of "optional", "prohibited", or "required"</value>
+ </entry>
+ <entry key="MustBeAAOU">
+ <value>must be one of "array", "atomic", "object", or "union"</value>
+ </entry>
+ <entry key="NoAddEnum_4">
+ <value>can not add value to enumeration of base-type $4</value>
+ </entry>
+ <entry key="NoOverrideBase_4">
+ <value>can not override base-type value of "$4"</value>
+ </entry>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_KEY">
+ <value>"$1": illegal key for $2</value>
+ <entry key="FieldDescriptor">
+ <value>field descriptor</value>
+ </entry>
+ <entry key="Type_34o">
+ <value>$3 type${ "4"}</value>
+ </entry>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_NAMESPACE">
+ <value>"$1": illegal explicit namespace for \$name; if given, must match schema namespace "$2"</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_PREFIX">
+ <value>"$1": illegal prefix (must not include ':')</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_SCHEMA">
+ <value>"$1": illegal schema${ at location "2"}: [$3]: $4</value>
+ </diagnostic>
+
+ <diagnostic code="ILLEGAL_TYPE">
+ <value>"$1": illegal type for $2; must be $3${ or 4}</value>
+ </diagnostic>
+
+ <diagnostic code="MISSING_KEY">
+ <value>"$1": missing key${ for type "2"} required${ 3}</value>
+ <entry key="NoInherit">
+ <value>when no base-type has it</value>
+ </entry>
+ </diagnostic>
+
+ <diagnostic code="NEW_KEY_NOT_ALLOWED">
+ <value>"$1": new key not allowed since \$open of base-type $2 is false</value>
+ </diagnostic>
+
+ <diagnostic code="SCHEMA_NOT_FOUND">
+ <value>"$1": could not find schema${ at location "2"}${: 3}</value>
+ </diagnostic>
+
+ <diagnostic code="TYPE_MISMATCH">
+ <value>"$1": type does not match required type of $2${ for 3}</value>
+ </diagnostic>
+
+ <diagnostic code="UNKNOWN_PREFIX">
+ <value>"$1": unknown prefix</value>
+ </diagnostic>
+
+ <diagnostic code="UNKNOWN_TYPE">
+ <value>"$1": unknown type</value>
+ </diagnostic>
+
+ <!-- $reasons -->
+
+ <diagnostic code="FACET_VIOLATION">
+ <value>$1</value>
+ <entry key="BadConstraint_23o4o5o">
+ <value>value violates \$constraints facet "$2" of type${ 3}${: [4]}${: 5}</value>
+ </entry>
+ <entry key="BadKey_23o">
+ <value>"$2": new key violates "false" value of \$open facet of type${ 3}</value>
+ </entry>
+ <entry key="BadValue_23o">
+ <value>value violates $2 facet of type${ 3}</value>
+ </entry>
+ </diagnostic>
+
+ <diagnostic code="TYPE_VIOLATION">
+ <value>"$1": invalid value type; must be $2</value>
+ <entry key="UnionMemberType">
+ <value>a union member type</value>
+ </entry>
+ </diagnostic>
+
+ </namespace>
+
<!--////////// Zorba Warnings ////////////////////////////////////////////-->
<namespace prefix="zwarn">
=== modified file 'src/diagnostics/diagnostic_namespaces.xml'
--- src/diagnostics/diagnostic_namespaces.xml 2013-10-15 23:27:57 +0000
+++ src/diagnostics/diagnostic_namespaces.xml 2013-12-06 05:12:46 +0000
@@ -55,6 +55,9 @@
<namespace prefix="jerr" uri="JSONIQ_ERR_NS"
class-prefix="JSONiqError" kind-function="standard"/>
+ <namespace prefix="jsd" uri="JSOUND_ERR_NS"
+ class-prefix="JSoundError" kind-function="unknown"/>
+
<namespace prefix="zerr" uri="ZORBA_ERR_NS"
class-prefix="ZorbaError" kind-function="unknown"/>
=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp 2013-10-15 23:27:57 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-12-06 05:12:46 +0000
@@ -1373,6 +1373,67 @@
} // namespace jerr
+namespace jsd {
+
+JSoundErrorCode DUPLICATE_PREFIX( "DUPLICATE_PREFIX" );
+
+
+JSoundErrorCode DUPLICATE_TYPE( "DUPLICATE_TYPE" );
+
+
+JSoundErrorCode ILLEGAL_ARRAY_SIZE( "ILLEGAL_ARRAY_SIZE" );
+
+
+JSoundErrorCode ILLEGAL_BASE_TYPE( "ILLEGAL_BASE_TYPE" );
+
+
+JSoundErrorCode ILLEGAL_FACET( "ILLEGAL_FACET" );
+
+
+JSoundErrorCode ILLEGAL_FACET_VALUE( "ILLEGAL_FACET_VALUE" );
+
+
+JSoundErrorCode ILLEGAL_KEY( "ILLEGAL_KEY" );
+
+
+JSoundErrorCode ILLEGAL_NAMESPACE( "ILLEGAL_NAMESPACE" );
+
+
+JSoundErrorCode ILLEGAL_PREFIX( "ILLEGAL_PREFIX" );
+
+
+JSoundErrorCode ILLEGAL_SCHEMA( "ILLEGAL_SCHEMA" );
+
+
+JSoundErrorCode ILLEGAL_TYPE( "ILLEGAL_TYPE" );
+
+
+JSoundErrorCode MISSING_KEY( "MISSING_KEY" );
+
+
+JSoundErrorCode NEW_KEY_NOT_ALLOWED( "NEW_KEY_NOT_ALLOWED" );
+
+
+JSoundErrorCode SCHEMA_NOT_FOUND( "SCHEMA_NOT_FOUND" );
+
+
+JSoundErrorCode TYPE_MISMATCH( "TYPE_MISMATCH" );
+
+
+JSoundErrorCode UNKNOWN_PREFIX( "UNKNOWN_PREFIX" );
+
+
+JSoundErrorCode UNKNOWN_TYPE( "UNKNOWN_TYPE" );
+
+
+JSoundErrorCode FACET_VIOLATION( "FACET_VIOLATION" );
+
+
+JSoundErrorCode TYPE_VIOLATION( "TYPE_VIOLATION" );
+
+
+} // namespace jsd
+
namespace zwarn {
ZorbaWarningCode ZWST0002_UNKNOWN_ANNOTATION( "ZWST0002" );
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2013-10-16 22:17:33 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2013-12-06 05:12:46 +0000
@@ -29,7 +29,10 @@
extern entry const dict_en[] = {
{ "CHARSET_UNKNOWN", "\"$1\": unknown or invalid character set" },
+ { "DUPLICATE_PREFIX", "\"$1\": duplicate prefix" },
+ { "DUPLICATE_TYPE", "\"$1\": duplicate type name" },
{ "EXTRA_VALUE", "\"$1\": extra value detected on line $2" },
+ { "FACET_VIOLATION", "$1" },
{ "FOAR0001", "division by zero" },
{ "FOAR0002", "numeric operation overflow/underflow${: 1}" },
{ "FOCA0001", "\"$1\": value too large for decimal" },
@@ -101,6 +104,15 @@
#if !defined(ZORBA_NO_FULL_TEXT)
{ "FTST0019", "\"$1\": match option specified more than once" },
#endif
+ { "ILLEGAL_ARRAY_SIZE", "\\$content facet must be array with exactly 1 element" },
+ { "ILLEGAL_BASE_TYPE", "\"$1\": illegal base-type${ for \"2\"}$3" },
+ { "ILLEGAL_FACET", "\"$1\": illegal facet for $2" },
+ { "ILLEGAL_FACET_VALUE", "\"$1\": illegal value for facet $2: $3" },
+ { "ILLEGAL_KEY", "\"$1\": illegal key for $2" },
+ { "ILLEGAL_NAMESPACE", "\"$1\": illegal explicit namespace for \\$name; if given, must match schema namespace \"$2\"" },
+ { "ILLEGAL_PREFIX", "\"$1\": illegal prefix (must not include ':')" },
+ { "ILLEGAL_SCHEMA", "\"$1\": illegal schema${ at location \"2\"}: [$3]: $4" },
+ { "ILLEGAL_TYPE", "\"$1\": illegal type for $2; must be $3${ or 4}" },
{ "INCOMPLETE_DATE_OR_TIME", "'$1': incomplete date, time, or dateTime format" },
{ "INSUFFICIENT_BUFFER", "\"$1\": insufficient value to parse for \"$2\"" },
{ "INVALID_ABSOLUTE_PATH", "path component of absolute URI must begin with /" },
@@ -132,9 +144,12 @@
{ "JNUP0017", "can not replace with less or more than an item" },
{ "JNUP0019", "\"$1\": invalid type (content of insert expression must evaluate to a sequence of objects)" },
{ "LITERAL_MISMATCH", "'$1': literal character mismatched '$2'" },
+ { "MISSING_KEY", "\"$1\": missing key${ for type \"2\"} required${ 3}" },
{ "MISSING_VALUE", "$1" },
+ { "NEW_KEY_NOT_ALLOWED", "\"$1\": new key not allowed since \\$open of base-type $2 is false" },
{ "OPAQUE_COMB_NOT_VALID", "cannot specify opaque-part in conjunction with host/port/path/user-info/query" },
{ "OPAQUE_WITHOUT_SCHEME", "scheme required when specifying opaque-part" },
+ { "SCHEMA_NOT_FOUND", "\"$1\": could not find schema${ at location \"2\"}${: 3}" },
{ "SENR0001", "\"$1\": can not serialize $2" },
{ "SEPM0004", "doctype-system parameter, or standalone parameter with a value other than \"omit\", specified" },
{ "SEPM0009", "omit-xml-declaration parameter is \"yes\" and $1" },
@@ -150,7 +165,11 @@
{ "SESU0007", "\"$1\": unsupported encoding" },
{ "SESU0011", "\"$1\": unsupported normalization form" },
{ "SESU0013", "\"$1\": unsupported $2 version; supported versions are: $3" },
+ { "TYPE_MISMATCH", "\"$1\": type does not match required type of $2${ for 3}" },
+ { "TYPE_VIOLATION", "\"$1\": invalid value type; must be $2" },
{ "UNKNOWN_LOCALE", "\"$1\": unknown locale" },
+ { "UNKNOWN_PREFIX", "\"$1\": unknown prefix" },
+ { "UNKNOWN_TYPE", "\"$1\": unknown type" },
{ "UNSUPPORTED_LOCALE", "\"$1\": unsupported locale" },
{ "URI_UNRESOLVED_OR_NOSTREAM", "\"$1\": stream is unresolved or it is not a stream - \"$2\"" },
{ "XPDY0002", "$1" },
@@ -594,6 +613,9 @@
{ "~ExprReturnsTooManyUpdateLists", "expression does not return a pending update list" },
{ "~ExternFnDeterministic", "only external functions may be declared deterministic" },
{ "~ExternFnNondeterministic", "only external functions may be declared nondeterministic" },
+ { "~FACET_VIOLATION_BadConstraint_23o4o5o", "value violates \\$constraints facet \"$2\" of type${ 3}${: [4]}${: 5}" },
+ { "~FACET_VIOLATION_BadKey_23o", "\"$2\": new key violates \"false\" value of \\$open facet of type${ 3}" },
+ { "~FACET_VIOLATION_BadValue_23o", "value violates $2 facet of type${ 3}" },
{ "~FOCA0002_BadLexicalQName_2", "\"$2\": value is not a valid lexical QName" },
{ "~FOCA0002_NoCastTo_234", "\"$2\": value of type $3 is not castable to type $4" },
{ "~FOCA0002_NoURIforPrefix_2", "no namespace URI provided for prefix in lexical QName \"$2\"" },
@@ -658,6 +680,20 @@
{ "~GoodValuesAreXMLEtc", "valid values are: xml, html, xhtml, text, binary, json, jsoniq" },
{ "~GoodValuesAreYesNo", "valid values are: yes, no" },
{ "~GoodValuesAreYesNoOmit", "valid values are: yes, no, omit" },
+ { "~ILLEGAL_BASE_TYPE_BecauseOfKey_45", " because of key \"$4\": $5" },
+ { "~ILLEGAL_BASE_TYPE_IncompatibleFacets_4", ": incompatible facet values for \"$4\"" },
+ { "~ILLEGAL_BASE_TYPE_MustBeX_4", ": must be \"$4\"" },
+ { "~ILLEGAL_BASE_TYPE_NotSubtype_45", ": \"$4\" is not a subtype of \"$5\"" },
+ { "~ILLEGAL_FACET_VALUE_BadConstraint_45", "[$4]: $5" },
+ { "~ILLEGAL_FACET_VALUE_BadPattern_45", "[$4]: $5" },
+ { "~ILLEGAL_FACET_VALUE_IncompatibleWith_45", "incompatible with $4 facet value of \"$5\"" },
+ { "~ILLEGAL_FACET_VALUE_MustBeAAOU", "must be one of \"array\", \"atomic\", \"object\", or \"union\"" },
+ { "~ILLEGAL_FACET_VALUE_MustBeGE0", "must be >= 0" },
+ { "~ILLEGAL_FACET_VALUE_MustBeOPR", "must be one of \"optional\", \"prohibited\", or \"required\"" },
+ { "~ILLEGAL_FACET_VALUE_NoAddEnum_4", "can not add value to enumeration of base-type $4" },
+ { "~ILLEGAL_FACET_VALUE_NoOverrideBase_4", "can not override base-type value of \"$4\"" },
+ { "~ILLEGAL_KEY_FieldDescriptor", "field descriptor" },
+ { "~ILLEGAL_KEY_Type_34o", "$3 type${ \"4\"}" },
{ "~INVALID_OPTION_MustBeASCIIChar", "must be single ASCII character" },
{ "~INVALID_OPTION_MustBeBoolean", "must be boolean" },
{ "~INVALID_OPTION_MustBeString", "must be string" },
@@ -682,6 +718,7 @@
{ "~JNUP0016_Array", "\"$2\": selector cannot be resolved against supplied array" },
{ "~JNUP0016_Object", "\"$2\": selector cannot be resolved against supplied object" },
{ "~LibModVersionMismatch_3", "XQuery library version can not be imported by a $3 version module" },
+ { "~MISSING_KEY_NoInherit", "when no base-type has it" },
{ "~MISSING_VALUE_Default", "\"$2\": missing value detected for this field on line $3" },
{ "~MISSING_VALUE_EmptyHeader", "empty header value detected on line 1" },
{ "~ModuleNotFound", "module not found" },
@@ -829,6 +866,7 @@
{ "~StingLiteral", "string literal" },
{ "~StringValue", "string value" },
{ "~SumImpossibleWithTypes_23", "sum not possible with parameters of type \"$2\" and \"$3\"" },
+ { "~TYPE_VIOLATION_UnionMemberType", "a union member type" },
{ "~TrailingChar_3", "trailing '$3'" },
{ "~TwoDecimalFormatsSameName_2", "\"$2\": two decimal formats with this name" },
{ "~TwoDefaultDecimalFormats", "two default decimal formats" },
=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h 2013-09-19 23:43:00 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-12-06 05:12:46 +0000
@@ -189,6 +189,25 @@
#define ZED_JNDY0021_UnexpectedToken_2 "~JNDY0021_UnexpectedToken_2"
#define ZED_JNDY0021_UnterminatedString "~JNDY0021_UnterminatedString"
#define ZED_JNDY0021_UnexpectedExtraContent "~JNDY0021_UnexpectedExtraContent"
+#define ZED_ILLEGAL_BASE_TYPE_BecauseOfKey_45 "~ILLEGAL_BASE_TYPE_BecauseOfKey_45"
+#define ZED_ILLEGAL_BASE_TYPE_IncompatibleFacets_4 "~ILLEGAL_BASE_TYPE_IncompatibleFacets_4"
+#define ZED_ILLEGAL_BASE_TYPE_MustBeX_4 "~ILLEGAL_BASE_TYPE_MustBeX_4"
+#define ZED_ILLEGAL_BASE_TYPE_NotSubtype_45 "~ILLEGAL_BASE_TYPE_NotSubtype_45"
+#define ZED_ILLEGAL_FACET_VALUE_BadConstraint_45 "~ILLEGAL_FACET_VALUE_BadConstraint_45"
+#define ZED_ILLEGAL_FACET_VALUE_BadPattern_45 "~ILLEGAL_FACET_VALUE_BadPattern_45"
+#define ZED_ILLEGAL_FACET_VALUE_IncompatibleWith_45 "~ILLEGAL_FACET_VALUE_IncompatibleWith_45"
+#define ZED_ILLEGAL_FACET_VALUE_MustBeGE0 "~ILLEGAL_FACET_VALUE_MustBeGE0"
+#define ZED_ILLEGAL_FACET_VALUE_MustBeOPR "~ILLEGAL_FACET_VALUE_MustBeOPR"
+#define ZED_ILLEGAL_FACET_VALUE_MustBeAAOU "~ILLEGAL_FACET_VALUE_MustBeAAOU"
+#define ZED_ILLEGAL_FACET_VALUE_NoAddEnum_4 "~ILLEGAL_FACET_VALUE_NoAddEnum_4"
+#define ZED_ILLEGAL_FACET_VALUE_NoOverrideBase_4 "~ILLEGAL_FACET_VALUE_NoOverrideBase_4"
+#define ZED_ILLEGAL_KEY_FieldDescriptor "~ILLEGAL_KEY_FieldDescriptor"
+#define ZED_ILLEGAL_KEY_Type_34o "~ILLEGAL_KEY_Type_34o"
+#define ZED_MISSING_KEY_NoInherit "~MISSING_KEY_NoInherit"
+#define ZED_FACET_VIOLATION_BadConstraint_23o4o5o "~FACET_VIOLATION_BadConstraint_23o4o5o"
+#define ZED_FACET_VIOLATION_BadKey_23o "~FACET_VIOLATION_BadKey_23o"
+#define ZED_FACET_VIOLATION_BadValue_23o "~FACET_VIOLATION_BadValue_23o"
+#define ZED_TYPE_VIOLATION_UnionMemberType "~TYPE_VIOLATION_UnionMemberType"
#define ZED_ZWST0005_RETURN_TYPE "~ZWST0005_RETURN_TYPE"
#define ZED_ZWST0005_PARAM_TYPE "~ZWST0005_PARAM_TYPE"
#define ZED_ZWST0005_UPDATING "~ZWST0005_UPDATING"
=== modified file 'src/diagnostics/pregenerated/qnames.cpp'
--- src/diagnostics/pregenerated/qnames.cpp 2013-10-15 23:27:57 +0000
+++ src/diagnostics/pregenerated/qnames.cpp 2013-12-06 05:12:46 +0000
@@ -40,6 +40,13 @@
return get_standard_error_kind( localname() );
}
+char const JSoundErrorQName::NAMESPACE[] = JSOUND_ERR_NS;
+char const JSoundErrorQName::PREFIX[] = "jsd";
+
+zorba::diagnostic::kind JSoundErrorQName::kind() const {
+ return zorba::diagnostic::UNKNOWN_KIND;
+}
+
char const ZorbaErrorQName::NAMESPACE[] = ZORBA_ERR_NS;
char const ZorbaErrorQName::PREFIX[] = "zerr";
=== modified file 'src/diagnostics/xquery_exception.cpp'
--- src/diagnostics/xquery_exception.cpp 2013-06-01 00:47:53 +0000
+++ src/diagnostics/xquery_exception.cpp 2013-12-06 05:12:46 +0000
@@ -229,9 +229,9 @@
XQueryStackTrace::fn_arity_type fn_arity = it->getFnArity();
zstring filename( it->getFileName() );
- if ( ascii::begins_with( filename, "file:" ) ) {
+ if ( ZA_BEGINS_WITH( filename, "file:" ) ) {
URI::decode_file_URI( filename, filename );
- while ( ascii::begins_with( filename, "//" ) )
+ while ( ZA_BEGINS_WITH( filename, "//" ) )
filename = filename.substr(1);
}
=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp 2013-09-26 03:22:53 +0000
+++ src/functions/library.cpp 2013-12-06 05:12:46 +0000
@@ -49,6 +49,7 @@
#include "functions/func_index_func.h"
#include "functions/func_item.h"
#include "functions/func_json.h"
+#include "functions/func_jsound.h"
#include "functions/func_maps.h"
#include "functions/func_maths.h"
#include "functions/func_nodes.h"
@@ -130,6 +131,7 @@
populate_context_index_func(sctx);
populate_context_ic_ddl(sctx);
populate_context_json(sctx);
+ populate_context_jsound(sctx);
populate_context_maths(sctx);
populate_context_nodes(sctx);
populate_context_item(sctx);
=== added file 'src/functions/pregenerated/func_jsound.cpp'
--- src/functions/pregenerated/func_jsound.cpp 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_jsound.cpp 2013-12-06 05:12:46 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+
+#include "stdafx.h"
+#include "runtime/jsound/jsound.h"
+#include "functions/func_jsound.h"
+
+
+namespace zorba{
+
+
+
+PlanIter_t fn_zorba_jsound_jsd_annotate::codegen(
+ CompilerCB*,
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& argv,
+ expr& ann) const
+{
+ return new JSoundAnnotateIterator(sctx, loc, argv);
+}
+
+PlanIter_t fn_zorba_jsound_jsd_validate::codegen(
+ CompilerCB*,
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& argv,
+ expr& ann) const
+{
+ return new JSoundValidateIterator(sctx, loc, argv);
+}
+
+void populate_context_jsound(static_context* sctx)
+{
+
+
+ {
+ DECL_WITH_KIND(sctx, fn_zorba_jsound_jsd_annotate,
+ (createQName("http://jsound.io/modules/jsound","","jsd-annotate"),
+ GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
+ GENV_TYPESYSTEM.ITEM_TYPE_ONE,
+ GENV_TYPESYSTEM.ITEM_TYPE_ONE),
+ FunctionConsts::FN_ZORBA_JSOUND_JSD_ANNOTATE_3);
+
+ }
+
+
+
+
+ {
+ DECL_WITH_KIND(sctx, fn_zorba_jsound_jsd_validate,
+ (createQName("http://jsound.io/modules/jsound","","jsd-validate"),
+ GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE,
+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
+ GENV_TYPESYSTEM.ITEM_TYPE_ONE,
+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
+ FunctionConsts::FN_ZORBA_JSOUND_JSD_VALIDATE_3);
+
+ }
+
+}
+
+
+}
+
+
+
=== added file 'src/functions/pregenerated/func_jsound.h'
--- src/functions/pregenerated/func_jsound.h 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_jsound.h 2013-12-06 05:12:46 +0000
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+
+#ifndef ZORBA_FUNCTIONS_JSOUND_H
+#define ZORBA_FUNCTIONS_JSOUND_H
+
+
+#include "common/shared_types.h"
+#include "functions/function_impl.h"
+
+
+namespace zorba {
+
+
+void populate_context_jsound(static_context* sctx);
+
+
+
+
+//fn-zorba-jsound:jsd-annotate
+class fn_zorba_jsound_jsd_annotate : public function
+{
+public:
+ fn_zorba_jsound_jsd_annotate(const signature& sig, FunctionConsts::FunctionKind kind)
+ :
+ function(sig, kind)
+ {
+
+ }
+
+ CODEGEN_DECL();
+};
+
+
+//fn-zorba-jsound:jsd-validate
+class fn_zorba_jsound_jsd_validate : public function
+{
+public:
+ fn_zorba_jsound_jsd_validate(const signature& sig, FunctionConsts::FunctionKind kind)
+ :
+ function(sig, kind)
+ {
+
+ }
+
+ CODEGEN_DECL();
+};
+
+
+} //namespace zorba
+
+
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h 2013-10-10 02:19:44 +0000
+++ src/functions/pregenerated/function_enum.h 2013-12-06 05:12:46 +0000
@@ -227,6 +227,8 @@
OP_ZORBA_JSON_RENAME_3,
OP_ZORBA_JSON_ARRAY_APPEND_2,
OP_ZORBA_JSON_BOX_1,
+ FN_ZORBA_JSOUND_JSD_ANNOTATE_3,
+ FN_ZORBA_JSOUND_JSD_VALIDATE_3,
MATH_SQRT_1,
MATH_EXP_1,
MATH_EXP10_1,
=== modified file 'src/runtime/CMakeLists.txt'
--- src/runtime/CMakeLists.txt 2013-10-01 22:39:42 +0000
+++ src/runtime/CMakeLists.txt 2013-12-06 05:12:46 +0000
@@ -153,6 +153,7 @@
)
ADD_SRC_SUBFOLDER(RUNTIME_SRCS csv CSV_SRCS)
+ADD_SRC_SUBFOLDER(RUNTIME_SRCS jsound JSOUND_SRCS)
ADD_SRC_SUBFOLDER(RUNTIME_SRCS seq SEQ_SRCS)
IF(NOT ZORBA_NO_FULL_TEXT)
=== added directory 'src/runtime/jsound'
=== added file 'src/runtime/jsound/CMakeLists.txt'
--- src/runtime/jsound/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/CMakeLists.txt 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+# Copyright 2006-2008 The FLWOR Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SET(JSOUND_SRCS
+ jsound_util.cpp
+ jsound_impl.cpp
+ )
+
+# vim:set et sw=2 ts=2:
=== added file 'src/runtime/jsound/jsound_impl.cpp'
--- src/runtime/jsound/jsound_impl.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/jsound_impl.cpp 2013-12-06 05:12:46 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+
+#include "diagnostics/xquery_exception.h"
+#include "runtime/jsound/jsound.h"
+#include "store/api/item_factory.h"
+#include "system/globalenv.h"
+
+#include "jsound_util.h"
+
+using namespace std;
+
+namespace zorba {
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool JSoundAnnotateIterator::nextImpl( store::Item_t &result,
+ PlanState &plan_state ) const {
+ store::Item_t jsd_item, type_item, json_item;
+
+ PlanIteratorState *state;
+ DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+ consumeNext( jsd_item, theChildren[0], plan_state );
+ consumeNext( type_item, theChildren[1], plan_state );
+ consumeNext( json_item, theChildren[2], plan_state );
+
+ try {
+ jsound::schema const schema( jsd_item, theSctx );
+ schema.validate( json_item, type_item->getStringValue(), &result );
+ }
+ catch ( ZorbaException &e ) {
+ set_source( e, loc, false );
+ throw;
+ }
+
+ STACK_PUSH( true, state );
+ STACK_END( state );
+}
+
+bool JSoundValidateIterator::nextImpl( store::Item_t &result,
+ PlanState &plan_state ) const {
+ store::Item_t jsd_item, type_item, json_item;
+
+ PlanIteratorState *state;
+ DEFAULT_STACK_INIT( PlanIteratorState, state, plan_state );
+
+ consumeNext( jsd_item, theChildren[0], plan_state );
+ consumeNext( type_item, theChildren[1], plan_state );
+ consumeNext( json_item, theChildren[2], plan_state );
+
+ try {
+ jsound::schema const schema( jsd_item, theSctx );
+ GENV_ITEMFACTORY->createBoolean(
+ result, schema.validate( json_item, type_item->getStringValue() )
+ );
+ }
+ catch ( ZorbaException &e ) {
+ set_source( e, loc, false );
+ throw;
+ }
+
+ STACK_PUSH( true, state );
+ STACK_END( state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */
=== added file 'src/runtime/jsound/jsound_util.cpp'
--- src/runtime/jsound/jsound_util.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/jsound_util.cpp 2013-12-06 05:12:46 +0000
@@ -0,0 +1,2479 @@
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+#include <cstring>
+#include <iostream>
+#include <sstream>
+
+#include <zorba/config.h>
+#include <zorba/diagnostic_list.h>
+#include <zorba/internal/cxx_util.h>
+#include <zorba/internal/unique_ptr.h>
+#include <zorba/store_consts.h>
+
+#include "compiler/api/compiler_api.h"
+#include "compiler/api/compilercb.h"
+#include "context/dynamic_context.h"
+#include "context/static_context.h"
+#include "diagnostics/assert.h"
+#include "diagnostics/xquery_exception.h"
+#include "runtime/base/plan_iterator.h"
+#include "runtime/booleans/BooleanImpl.h"
+#include "runtime/json/json_loader.h"
+#include "store/api/item.h"
+#include "store/api/item_factory.h"
+#include "store/api/iterator.h"
+#include "system/globalenv.h"
+#include "system/properties.h"
+#include "types/casting.h"
+#include "types/root_typemanager.h"
+#include "types/typeops.h"
+#include "util/ascii_util.h"
+#include "util/fs_util.h"
+#include "util/less.h"
+#include "util/regex.h"
+#include "util/stl_util.h"
+#include "util/string_util.h"
+#include "util/xml_util.h"
+#include "zorbamisc/ns_consts.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/numconversions.h"
+
+#include "jsound_util.h"
+
+// Change to "1" to include $raise-file and $raise-line in annotated results.
+#define INVALID_RAISE_LOCATION 0
+
+namespace zorba {
+namespace ztd {
+
+// TODO: these functions should be put in some header somewhere
+
+inline zstring to_string( store::Item const &i ) {
+ return i.toString();
+}
+
+inline zstring to_string( store::Item_t const &i ) {
+ return !i ? "<null>" : to_string( *i );
+}
+
+} // namespace ztd
+} // namespace zorba
+
+using namespace std;
+
+namespace zorba {
+namespace jsound {
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * A %constraint is a JSONiq expression that tests the value of a JSON item for
+ * compliance.
+ */
+struct constraint {
+ zstring const query_;
+
+ constraint( zstring const &query );
+ constraint( constraint const& );
+ // default destructor is fine
+
+ bool validate( dynamic_context& ) const;
+
+private:
+ CompilerCB ccb_;
+ PlanIter_t plan_;
+ static_context_t sctx_;
+
+ static XQueryDiagnostics* get_shared_diagnostics();
+};
+
+typedef vector<constraint> constraints_type;
+typedef vector<store::Item_t> enumeration_type;
+typedef unsigned short facet_mask;
+
+/**
+ * The different kinds of JSound types.
+ */
+enum kind {
+ k_none,
+ k_array,
+ k_atomic,
+ k_object,
+ k_union
+};
+ostream& operator<<( ostream&, kind );
+
+/**
+ * Internal values for the $explicitTimezone facet.
+ */
+namespace timezone {
+ enum type {
+ prohibited,
+ optional,
+ required
+ };
+}
+ostream& operator<<( ostream&, timezone::type );
+
+/**
+ * The abstract base class for all JSound types.
+ */
+struct type {
+ zstring about_;
+ type const *baseType_;
+ constraints_type constraints_;
+ enumeration_type enumeration_;
+ facet_mask facet_mask_;
+ kind const kind_;
+ zstring name_;
+
+ type( kind );
+ virtual ~type();
+
+ void to_json( store::Item_t* ) const;
+
+protected:
+ virtual void assert_subtype_of( type const* ) const = 0;
+ void load_about( store::Item_t const& );
+ type const* find_facet( facet_mask facet ) const;
+ virtual void load_baseType( store::Item_t const&, schema const& );
+ void load_constraints( store::Item_t const& );
+ void load_enumeration( store::Item_t const& );
+ virtual void load_type( store::Item_t const&, schema& ) = 0;
+ void load_name( store::Item_t const&, schema const& );
+ virtual bool validate( store::Item_t const&,
+ store::Item_t* = nullptr ) const;
+
+private:
+ bool is_enum_valid( store::Item_t const &item ) const;
+
+ friend struct array_type;
+ friend struct atomic_type;
+ friend struct min_max_type;
+ friend struct object_type;
+ friend struct schema;
+ friend struct union_type;
+};
+typedef type type_type; // eliminate special case for macros
+
+/**
+ * This is a base class for array_type and atomic_type to factor out code for
+ * their common facets.
+ */
+struct min_max_type : type {
+ int minLength_;
+ int maxLength_;
+
+protected:
+ void load_maxLength( store::Item_t const& );
+ void load_minLength( store::Item_t const& );
+
+ min_max_type( kind );
+
+ friend struct schema;
+};
+
+/**
+ * The JSound array type.
+ */
+struct array_type : min_max_type {
+ typedef type const* content_type;
+ content_type content_;
+
+ array_type();
+
+protected:
+ virtual void assert_subtype_of( type const* ) const;
+ virtual void load_type( store::Item_t const&, schema& );
+ virtual bool validate( store::Item_t const&, store::Item_t* ) const;
+
+private:
+ void load_content( store::Item_t const&, schema& );
+
+ friend struct schema;
+};
+
+/**
+ * The JSound atomic type.
+ */
+struct atomic_type : min_max_type {
+ store::SchemaTypeCode schemaTypeCode_;
+
+ // string, anyURI, base64Binary, hexBinary
+ int length_;
+
+ // date, dateTime, time, gYear, gYearMOnth, gMonth, gMondyDay, gDay,
+ // duration, decimal (and all derived types), double, float
+ store::Item_t maxExclusive_;
+ store::Item_t maxInclusive_;
+ store::Item_t minExclusive_;
+ store::Item_t minInclusive_;
+
+ // decimal (and all derived types)
+ int totalDigits_;
+
+ // decimal (only)
+ int fractionDigits_;
+
+ // date, dateTime, time
+ timezone::type explicitTimezone_;
+
+ // all types
+ zstring pattern_;
+ mutable unicode::regex pattern_re_;
+
+ atomic_type();
+
+protected:
+ virtual void assert_subtype_of( type const* ) const;
+ virtual void load_baseType( store::Item_t const&, schema const& );
+ virtual void load_type( store::Item_t const&, schema& );
+ virtual bool validate( store::Item_t const&, store::Item_t* ) const;
+
+private:
+ void assert_min_max_facet( store::Item_t const&, char const* ) const;
+ void load_explicitTimezone( store::Item_t const& );
+ void load_fractionDigits( store::Item_t const& );
+ void load_length( store::Item_t const& );
+ void load_maxInclusive( store::Item_t const& );
+ void load_minInclusive( store::Item_t const& );
+ void load_maxExclusive( store::Item_t const& );
+ void load_minExclusive( store::Item_t const& );
+ void load_pattern( store::Item_t const& );
+ void load_totalDigits( store::Item_t const& );
+};
+
+/**
+ * The JSound object type.
+ */
+struct object_type : type {
+ struct field_descriptor {
+ public:
+ type const *type_;
+ bool optional_;
+ store::Item_t default_;
+
+ field_descriptor();
+ // default copy constructor is OK
+ // defalut assignment operator is OK
+ // default destructor is OK
+
+ private:
+ void load_default( store::Item_t const& );
+ void load_optional( store::Item_t const& );
+ void load_type( store::Item_t const&, schema& );
+ friend struct object_type;
+ };
+
+ typedef zstring key_type;
+ typedef field_descriptor value_type;
+ typedef unordered_map<key_type,value_type> content_type;
+
+ content_type content_;
+ bool open_;
+
+ object_type();
+
+protected:
+ virtual void assert_subtype_of( type const* ) const;
+ virtual void load_type( store::Item_t const&, schema& );
+ virtual bool validate( store::Item_t const&, store::Item_t* ) const;
+
+private:
+ void assert_subtype_of_helper( type const*, bool,
+ unordered_set<zstring>* ) const;
+ void catch_helper( ZorbaException const&, type const*, zstring const& ) const;
+ void load_content( store::Item_t const&, schema& );
+ void load_field_descriptor( store::Item_t const&, schema&,
+ field_descriptor* );
+ void load_open( store::Item_t const& );
+
+ friend class schema;
+};
+
+/**
+ * The JSound union type.
+ */
+struct union_type : type {
+ typedef type const* value_type;
+ typedef vector<value_type> content_type;
+
+ content_type content_;
+
+ union_type();
+
+protected:
+ virtual void assert_subtype_of( type const* ) const;
+ virtual void load_type( store::Item_t const&, schema& );
+ virtual bool validate( store::Item_t const&, store::Item_t* ) const;
+
+private:
+ void load_content( store::Item_t const&, schema& );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Adds the given facet to the facet mask.
+ * This macro assumes that the following variables are available in the same
+ * (or enclosing) scope: \c facet_mask_.
+ *
+ * @param FACET The facet to add.
+ * \hideinitializer
+ */
+#define ADD_FACET(FACET) \
+ facet_mask_ |= facet_##FACET
+
+/**
+ * Asserts that the given expression is \c true for the given facet;
+ * if \c false, an exception is thrown.
+ *
+ * @param TYPE The type having the facet.
+ * @param FACET The relevant facet.
+ * @param EXPR The expression to evaluate. Within the expression, the local
+ * variable \c bt (the first base type object having \a FACET) can be used.
+ * \hideinitializer
+ */
+#define ASSERT_BASE_FACET(TYPE,FACET,EXPR) \
+ do { \
+ TYPE##_type const *const bt = FIND_FACET( TYPE, baseType_, FACET ); \
+ if ( bt && !(EXPR) ) \
+ throw XQUERY_EXCEPTION( \
+ jsd::ILLEGAL_FACET_VALUE, \
+ ERROR_PARAMS( ztd::to_string( FACET##_ ), "$" #FACET, ZED( ILLEGAL_FACET_VALUE_NoOverrideBase_4 ), ztd::to_string( bt->FACET##_ ) ) \
+ ); \
+ } while (0)
+
+/**
+ * Asserts that the given expression is \c true for the given facets;
+ * if \c false, an exception is thrown.
+ *
+ * @param TYPE The type having the facet.
+ * @param THIS_FACET The new facet.
+ * @param THAT_FACET The other facet.
+ * @param EXPR The expression to evaluate. Within the expression, the local
+ * variable \c tt (the "that" type object having \a FACET) can be used.
+ * \hideinitializer
+ * \hideinitializer
+ */
+#define ASSERT_COMPATIBLE_FACETS(TYPE,THIS_FACET,THAT_FACET,EXPR) \
+ do { \
+ TYPE##_type const *const tt = FIND_FACET( TYPE, this, THAT_FACET ); \
+ if ( tt && !(EXPR) ) \
+ throw XQUERY_EXCEPTION( \
+ jsd::ILLEGAL_FACET_VALUE, \
+ ERROR_PARAMS( ztd::to_string( THIS_FACET##_ ), "$" #THIS_FACET, ZED( ILLEGAL_FACET_VALUE_IncompatibleWith_45 ), "$" #THAT_FACET, ztd::to_string( tt->THAT_FACET##_ ) ) \
+ ); \
+ } while (0)
+
+/**
+ * Asserts that the given item is a particular kind; if not, an exception is
+ * thrown.
+ *
+ * @param ITEM The item to check.
+ * @param NAME The name of the thing (facet, usually) that must be a particular
+ * kind.
+ * @param KIND The item kind that \a ITEM must be.
+ * \hideinitializer
+ */
+#define ASSERT_KIND(ITEM,NAME,KIND) \
+ assert_kind( ITEM, NAME, store::Item::KIND )
+
+/**
+ * Asserts that a facet value for a subtype is compatible with that of the base
+ * type; if not, an exception is thrown.
+ *
+ * @param TYPE The type having the facet.
+ * @param OBJ The base-type object.
+ * @param FACET The relevant facet.
+ * @param EXPR The expression to evaluate. Within the expression, the local
+ * variables \c bt (the first base type object having \a FACET) and \c dt (the
+ * first derived type object having \a FACET) can be used.
+ * \hideinitializer
+ */
+#define ASSERT_SUBTYPE_FACET(TYPE,OBJ,FACET,EXPR) \
+ do { \
+ TYPE##_type const *const bt = FIND_FACET( TYPE, (OBJ), FACET ); \
+ TYPE##_type const *const dt = FIND_FACET( TYPE, this, FACET ); \
+ if ( bt && dt && bt != dt && !(EXPR) ) \
+ throw XQUERY_EXCEPTION( jsd::ILLEGAL_BASE_TYPE, ERROR_PARAMS( (OBJ)->name_, name_, ZED( ILLEGAL_BASE_TYPE_IncompatibleFacets_4 ), "$" #FACET ) ); \
+ } while (0)
+
+/**
+ * Asserts that the given item is a particular atomic type; if not, an
+ * exception is thrown.
+ *
+ * @param ITEM The item to check.
+ * @param NAME The name of the thing (facet, usually) that must be a particular
+ * atomic type.
+ * @param TYPE The XML schema type code that \a ITEM must be.
+ * \hideinitializer
+ */
+#define ASSERT_TYPE(ITEM,NAME,TYPE) \
+ assert_type( ITEM, NAME, store::TYPE )
+
+/**
+ * Declares the variable \c baseType in the current scope that is a type's
+ * \c baseType_ \c static_cast to \a TYPE.
+ * This macro assumes that the following variables are available in the same
+ * (or enclosing) scope: \c baseType_.
+ *
+ * @param TYPE The derived type to \c static_cast to.
+ * \hideinitializer
+ */
+#define DECL_baseType(TYPE) \
+ DECL_static_cast( TYPE, baseType, baseType_ )
+
+/**
+ * Declares a pointer variable \a D in the current scope that is the result of
+ * a \c dynamic_cast of the pointer variable \a B to \a TYPE.
+ * If the object to which \c B points is not of type \a TYPE, throws an
+ * exception.
+ *
+ * @param TYPE The derived type to \c dynamic_cast to.
+ * @param D The pointer variable to declare.
+ * @param B The pointer variable to cast.
+ * \hideinitializer
+ */
+#define DECL_dynamic_cast(TYPE,D,B) \
+ TYPE##_type const *const D = dynamic_cast<TYPE##_type const*>( B ); \
+ do { \
+ if ( !D ) \
+ throw XQUERY_EXCEPTION( jsd::ILLEGAL_BASE_TYPE, ERROR_PARAMS( (B)->name_, name_, ZED( ILLEGAL_BASE_TYPE_MustBeX_4 ), #TYPE ) ); \
+ } while (0)
+
+/**
+ * Declares a variable <i>FACET</i><code>_type</code> in the current scope that
+ * is the result of calling the FIND_FACET() macro.
+ *
+ * @param TYPE The type to pass to FIND_FACET().
+ * @param OBJ The type object to pass to FIND_FACET().
+ * @param FACET The relevant facet.
+ * \hideinitializer
+ */
+#define DECL_FACET_type(TYPE,OBJ,FACET) \
+ TYPE##_type const *const FACET##_type = FIND_FACET( TYPE, OBJ, FACET )
+
+/**
+ * Declares a pointer variable \a D in the current scope that is the result of
+ * a \c static_cast of the pointer variable \a B to type \a TYPE.
+ *
+ * @param TYPE The derived type to \c static_cast to.
+ * @param D The pointer variable to declare.
+ * @Param B The pointer variable to cast.
+ */
+#define DECL_static_cast(TYPE,D,B) \
+ TYPE##_type const *const D = static_cast<TYPE##_type const*>( B )
+
+/**
+ * Calls the XQUERY_EXCEPTION macro passing jsd::ILLEGAL_FACET_VALUE as the
+ * diagnostic.
+ *
+ * @param FACET The facet that has been violated.
+ * @param REASON The partial key entry in ths diagnostics dictionary to use.
+ * @return Returns a ZorbaException.
+ * \hideinitializer
+ */
+#define FACET_VALUE_EXCEPTION(FACET,REASON) \
+ XQUERY_EXCEPTION( \
+ jsd::ILLEGAL_FACET_VALUE, \
+ ERROR_PARAMS( ztd::to_string( FACET##_ ), "$" #FACET, ZED( ILLEGAL_FACET_VALUE_##REASON ) ) \
+ )
+
+/**
+ * Finds the type object among a type object's base types that has the given
+ * facet, if any.
+ *
+ * @param TYPE The type class to down-cast the result to.
+ * @param OBJ The type object to begin the search at; may be \c nullptr.
+ * @param FACET The facet to find.
+ * @return Returns a pointer to the type object (cast to \a TYPE) having
+ * \a FACET or null if none.
+ * \hideinitializer
+ */
+#define FIND_FACET(TYPE,OBJ,FACET) \
+ ( (OBJ) ? static_cast<TYPE##_type const*>( (OBJ)->find_facet( facet_##FACET ) ) : nullptr )
+
+/**
+ * Tests whether the given item is both an atomic type and whether said type is
+ * a subtype of the given type.
+ *
+ * @param ITEM The item whose type test.
+ * @param TYPE The atomic schema type to test against.
+ * @return Returns \a true only if \a ITEM is atomic and a subtype of \a TYPE.
+ * \hideinitializer
+ */
+#define IS_ATOMIC_TYPE(ITEM,TYPE) \
+ ( (ITEM)->isAtomic() && IS_SUBTYPE( (ITEM)->getTypeCode(), TYPE ) )
+
+/**
+ * Tests whether one schema type is a subtype of the other.
+ *
+ * @param T The schema type to test whether it's a subtype of \a U.
+ * @param U The schema type to test against.
+ * @return Returns \a true only if \a T is a subtype of \a U.
+ * \hideinitializer
+ */
+#define IS_SUBTYPE(T,U) \
+ TypeOps::is_subtype( (T), store::U )
+
+/**
+ * Tests whether the given item is the right kind of item.
+ *
+ * @param ITEM The item whose kind to test.
+ * @param KIND The item kind to test against.
+ * @return Returns \a true only if \a ITEM is of kind \a KIND.
+ * \hideinitializer
+ */
+#define IS_KIND(ITEM,KIND) \
+ ( (ITEM)->getKind() == store::Item::KIND )
+
+/**
+ * Calls make_invalid() passing the current file and line number.
+ *
+ * @param TYPE The expected type.
+ * @param ITEM The invalid JSON item.
+ * @param RESULT A pointer to the result item to be constructed.
+ * \hideinitializer
+ */
+#define MAKE_INVALID(TYPE,ITEM,RESULT,...) \
+ make_invalid( __FILE__, __LINE__, (TYPE), (ITEM), (RESULT), __VA_ARGS__ )
+
+/**
+ * Returns \c false from the enclosing function.
+ * This macro assumes that the following variables are available in the same
+ * (or enclosing) scope: \c this, \c reslut, and \c validate_item.
+ * If \c result is non-null, the MAKE_INVALID() macro is called.
+ * \hideinitializer
+ */
+#define RETURN_INVALID(...) \
+ do { \
+ if ( result ) \
+ MAKE_INVALID( this, validate_item, result, __VA_ARGS__ ); \
+ return false; \
+ } while (0)
+
+/**
+ * Validates that the given facet is not violated.
+ * This macro assumes that the following variables are available in the same
+ * (or enclosing) scope: \c name_, \c validate_item, and \c result.
+ * If the facet has not been violated, nothing happens and program control flow
+ * continues to the next statement.
+ * If the facet has been violated, the RETURN_INVALID() macro is called.
+ *
+ * @param FACET The facet to validate.
+ * @param EXPR The expression to evaluate: if \c false, the facet has been
+ * violated.
+ * \hideinitializer
+ */
+#define VALIDATE_FACET(FACET,EXPR) \
+ do { \
+ if ( FACET##_type && !(EXPR) ) \
+ RETURN_INVALID( jsd::FACET_VIOLATION, ERROR_PARAMS( ZED( FACET_VIOLATION_BadValue_23o ), "$" #FACET, FACET##_type->name_ ) ); \
+ } while (0)
+
+/**
+ * Validates that the given item is the right kind of item.
+ * If the item is the right kind of item, nothing happens and program control
+ * flow continues to the next statement.
+ * If the item is not the right kind of item, then the RETURN_INVALID() macro
+ * is called.
+ *
+ * @param ITEM The item whose kind to validate.
+ * @param KIND The kind to ensure \a ITEM is.
+ * \hideinitializer
+ */
+#define VALIDATE_KIND(ITEM,KIND) \
+ do { \
+ if ( !IS_KIND( ITEM, KIND ) ) \
+ RETURN_INVALID( jsd::TYPE_VIOLATION, ERROR_PARAMS( to_type_str( validate_item ), store::Item::KIND ) ); \
+ } while (0)
+
+///////////////////////////////////////////////////////////////////////////////
+
+static facet_mask const facet_constraints = 1 << 0;
+static facet_mask const facet_enumeration = 1 << 1;
+static facet_mask const facet_explicitTimezone = 1 << 2;
+static facet_mask const facet_fractionDigits = 1 << 3;
+static facet_mask const facet_length = 1 << 4;
+static facet_mask const facet_maxExclusive = 1 << 5;
+static facet_mask const facet_maxInclusive = 1 << 6;
+static facet_mask const facet_maxLength = 1 << 7;
+static facet_mask const facet_minExclusive = 1 << 8;
+static facet_mask const facet_minInclusive = 1 << 9;
+static facet_mask const facet_minLength = 1 << 10;
+static facet_mask const facet_open = 1 << 11;
+static facet_mask const facet_pattern = 1 << 12;
+static facet_mask const facet_totalDigits = 1 << 13;
+
+static void append_item( char const *s, vector<store::Item_t> *v ) {
+ zstring s2( s );
+ store::Item_t item;
+ GENV_ITEMFACTORY->createString( item, s2 );
+ v->push_back( item );
+}
+
+inline void append_item( zstring const &s, vector<store::Item_t> *v ) {
+ append_item( s.c_str(), v );
+}
+
+static void assert_kind( store::Item_t const &item, char const *name,
+ store::Item::ItemKind kind ) {
+ if ( item->getKind() != kind )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_TYPE,
+ ERROR_PARAMS( item->getKind(), name, kind )
+ );
+}
+
+inline void assert_kind( store::Item_t const &item, zstring const &name,
+ store::Item::ItemKind kind ) {
+ assert_kind( item, name.c_str(), kind );
+}
+
+static void assert_type( store::Item_t const &item, char const *name,
+ store::SchemaTypeCode stc ) {
+ if ( !item->isAtomic() )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_TYPE,
+ ERROR_PARAMS( item->getKind(), name, store::Item::ATOMIC )
+ );
+ store::SchemaTypeCode const item_stc = item->getTypeCode();
+ if ( !TypeOps::is_subtype( item_stc, stc ) )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_TYPE, ERROR_PARAMS( item_stc, name, stc )
+ );
+}
+
+inline void assert_type( store::Item_t const &item, zstring const &name,
+ store::SchemaTypeCode stc ) {
+ assert_type( item, name.c_str(), stc );
+}
+
+inline bool is_atomic_type( store::Item_t const &item,
+ store::SchemaTypeCode stc ) {
+ return item->isAtomic() && TypeOps::is_subtype( item->getTypeCode(), stc );
+}
+
+static store::SchemaTypeCode map_atomic_type( zstring const &type_name ) {
+ zstring temp_name( type_name );
+ if ( ZA_BEGINS_WITH( temp_name, "xs:" ) )
+ temp_name.erase( 0, 3 );
+
+ // check common types first
+ if ( ZSTREQ( temp_name, "string" ) )
+ return store::XS_STRING;
+ if ( ZSTREQ( temp_name, "boolean" ) )
+ return store::XS_BOOLEAN;
+ if ( ZSTREQ( temp_name, "integer" ) )
+ return store::XS_INTEGER;
+ if ( ZSTREQ( temp_name, "decimal" ) )
+ return store::XS_DECIMAL;
+ if ( ZSTREQ( temp_name, "double" ) )
+ return store::XS_DOUBLE;
+ if ( ZSTREQ( temp_name, "float" ) )
+ return store::XS_FLOAT;
+
+ if ( ZSTREQ( temp_name, "date" ) )
+ return store::XS_DATE;
+ if ( ZSTREQ( temp_name, "dateTime" ) )
+ return store::XS_DATETIME;
+ if ( ZSTREQ( temp_name, "dateTimeStamp" ) )
+ return store::XS_DATETIME_STAMP;
+ if ( ZSTREQ( temp_name, "dayTimeDuration" ) )
+ return store::XS_DT_DURATION;
+ if ( ZSTREQ( temp_name, "duration" ) )
+ return store::XS_DURATION;
+ if ( ZSTREQ( temp_name, "time" ) )
+ return store::XS_TIME;
+ if ( ZSTREQ( temp_name, "anyURI" ) )
+ return store::XS_ANY_URI;
+ if ( ZSTREQ( temp_name, "base64Binary" ) )
+ return store::XS_BASE64BINARY;
+ if ( ZSTREQ( temp_name, "byte" ) )
+ return store::XS_BYTE;
+ if ( ZSTREQ( temp_name, "gDay" ) )
+ return store::XS_GDAY;
+ if ( ZSTREQ( temp_name, "gMonth" ) )
+ return store::XS_GMONTH;
+ if ( ZSTREQ( temp_name, "gMonthDay" ) )
+ return store::XS_GMONTH_DAY;
+ if ( ZSTREQ( temp_name, "gYear" ) )
+ return store::XS_GYEAR;
+ if ( ZSTREQ( temp_name, "gYearMonth" ) )
+ return store::XS_GYEAR_MONTH;
+ if ( ZSTREQ( temp_name, "hexBinary" ) )
+ return store::XS_HEXBINARY;
+ if ( ZSTREQ( temp_name, "long" ) )
+ return store::XS_LONG;
+ if ( ZSTREQ( temp_name, "negativeInteger" ) )
+ return store::XS_NEGATIVE_INTEGER;
+ if ( ZSTREQ( temp_name, "nonNegativeInteger" ) )
+ return store::XS_NON_NEGATIVE_INTEGER;
+ if ( ZSTREQ( temp_name, "nonPositiveInteger" ) )
+ return store::XS_NON_POSITIVE_INTEGER;
+ if ( ZSTREQ( temp_name, "positiveInteger" ) )
+ return store::XS_POSITIVE_INTEGER;
+ if ( ZSTREQ( temp_name, "short" ) )
+ return store::XS_SHORT;
+ if ( ZSTREQ( temp_name, "unsignedByte" ) )
+ return store::XS_UNSIGNED_BYTE;
+ if ( ZSTREQ( temp_name, "unsignedInt" ) )
+ return store::XS_UNSIGNED_INT;
+ if ( ZSTREQ( temp_name, "unsignedLong" ) )
+ return store::XS_UNSIGNED_LONG;
+ if ( ZSTREQ( temp_name, "unsignedShort" ) )
+ return store::XS_UNSIGNED_SHORT;
+ if ( ZSTREQ( temp_name, "yearMonthDuration" ) )
+ return store::XS_YM_DURATION;
+ return store::XS_LAST;
+}
+
+static kind map_kind( store::Item::ItemKind k ) {
+ switch ( k ) {
+ case store::Item::ARRAY : return k_array ;
+ case store::Item::ATOMIC: return k_atomic;
+ case store::Item::OBJECT: return k_object;
+ default : return k_none ;
+ }
+}
+
+static void assert_type_matches( store::Item_t const &item, type const *t,
+ char const *name = "" ) {
+ kind const k = map_kind( item->getKind() );
+ if ( k != t->kind_ )
+ throw XQUERY_EXCEPTION(
+ jsd::TYPE_MISMATCH,
+ ERROR_PARAMS( k, t->kind_, name )
+ );
+ if ( item->isAtomic() ) {
+ DECL_static_cast( atomic, cast_t, t );
+ store::SchemaTypeCode const item_stc = item->getTypeCode();
+ if ( !TypeOps::is_subtype( item_stc, cast_t->schemaTypeCode_ ) )
+ throw XQUERY_EXCEPTION(
+ jsd::TYPE_MISMATCH, ERROR_PARAMS( item_stc, t->name_, name )
+ );
+ }
+}
+
+inline void assert_type_matches( store::Item_t const &item, type const *t,
+ zstring const &name ) {
+ assert_type_matches( item, t, name.c_str() );
+}
+
+static type const* find_builtin_atomic_type( zstring const &type_name,
+ bool not_found_error = true ) {
+ typedef map<char const*,atomic_type const*> map_type;
+ static map_type m;
+
+#define INIT_ATOMIC_TYPE(TYPE,CODE) \
+ static atomic_type instance_##TYPE; \
+ instance_##TYPE.name_ = #TYPE; \
+ instance_##TYPE.schemaTypeCode_ = store::CODE; \
+ m[ #TYPE ] = &instance_##TYPE
+
+ if ( m.empty() ) {
+ INIT_ATOMIC_TYPE( anyURI, XS_ANY_URI );
+ INIT_ATOMIC_TYPE( base64Binary, XS_BASE64BINARY );
+ INIT_ATOMIC_TYPE( boolean, XS_BOOLEAN );
+ INIT_ATOMIC_TYPE( date, XS_DATE );
+ INIT_ATOMIC_TYPE( dateTime, XS_DATETIME );
+ INIT_ATOMIC_TYPE( dateTimeStamp, XS_DATETIME_STAMP );
+ INIT_ATOMIC_TYPE( dayTimeDuration, XS_DT_DURATION );
+ INIT_ATOMIC_TYPE( decimal, XS_DECIMAL );
+ INIT_ATOMIC_TYPE( double, XS_DOUBLE );
+ INIT_ATOMIC_TYPE( duration, XS_DURATION );
+ INIT_ATOMIC_TYPE( float, XS_FLOAT );
+ INIT_ATOMIC_TYPE( gDay, XS_GDAY );
+ INIT_ATOMIC_TYPE( gMonth, XS_GMONTH );
+ INIT_ATOMIC_TYPE( gMonthDay, XS_GMONTH_DAY );
+ INIT_ATOMIC_TYPE( gYear, XS_GYEAR );
+ INIT_ATOMIC_TYPE( gYearMonth, XS_GYEAR_MONTH );
+ INIT_ATOMIC_TYPE( hexBinary, XS_HEXBINARY );
+ INIT_ATOMIC_TYPE( string, XS_STRING );
+ INIT_ATOMIC_TYPE( time, XS_TIME );
+ INIT_ATOMIC_TYPE( yearMonthDuration, XS_YM_DURATION );
+
+#define INIT_ATOMIC_TYPE_BASE(TYPE,CODE,BASE) \
+ INIT_ATOMIC_TYPE(TYPE,CODE); \
+ instance_##TYPE.baseType_ = &instance_##BASE
+
+ INIT_ATOMIC_TYPE_BASE( integer, XS_INTEGER, decimal );
+ INIT_ATOMIC_TYPE_BASE( long, XS_LONG, integer );
+ INIT_ATOMIC_TYPE_BASE( int, XS_INT, long );
+ INIT_ATOMIC_TYPE_BASE( short, XS_SHORT, int );
+ INIT_ATOMIC_TYPE_BASE( byte, XS_BYTE, short );
+ INIT_ATOMIC_TYPE_BASE( nonPositiveInteger, XS_NON_POSITIVE_INTEGER, integer );
+ INIT_ATOMIC_TYPE_BASE( negativeInteger, XS_NEGATIVE_INTEGER, nonPositiveInteger );
+ INIT_ATOMIC_TYPE_BASE( nonNegativeInteger, XS_NON_NEGATIVE_INTEGER, integer );
+ INIT_ATOMIC_TYPE_BASE( positiveInteger, XS_POSITIVE_INTEGER, nonNegativeInteger );
+ INIT_ATOMIC_TYPE_BASE( unsignedLong, XS_UNSIGNED_LONG, nonNegativeInteger );
+ INIT_ATOMIC_TYPE_BASE( unsignedInt, XS_UNSIGNED_INT, unsignedLong );
+ INIT_ATOMIC_TYPE_BASE( unsignedShort, XS_UNSIGNED_SHORT, unsignedInt );
+ INIT_ATOMIC_TYPE_BASE( unsignedByte, XS_UNSIGNED_BYTE, unsignedShort );
+
+// This may not be necessary.
+#if 0
+
+#define INIT_ATOMIC_FACET(type,Type,FACET,VALUE) \
+ GENV_ITEMFACTORY->create##Type( instance_##type.FACET##_, xs_##type(VALUE) )
+
+ INIT_ATOMIC_FACET( byte, Byte, maxInclusive, 127 );
+ INIT_ATOMIC_FACET( byte, Byte, minInclusive, -128 );
+ INIT_ATOMIC_FACET( int, Int, maxInclusive, 2147483647 );
+ INIT_ATOMIC_FACET( int, Int, minInclusive, -2147483648 );
+ INIT_ATOMIC_FACET( long, Long, maxInclusive, 9223372036854775807L );
+ INIT_ATOMIC_FACET( long, Long, minInclusive, -9223372036854775808L );
+ INIT_ATOMIC_FACET( negativeInteger, NegativeInteger, maxInclusive, -1 );
+ INIT_ATOMIC_FACET( nonNegativeInteger, NonNegativeInteger, minInclusive, 0 );
+ INIT_ATOMIC_FACET( nonPositiveInteger, NonPositiveInteger, maxInclusive, 0 );
+ INIT_ATOMIC_FACET( positiveInteger, PositiveInteger, minInclusive, 1 );
+ INIT_ATOMIC_FACET( short, Short, maxInclusive, 32767 );
+ INIT_ATOMIC_FACET( short, Short, minInclusive, -32768 );
+ INIT_ATOMIC_FACET( unsignedByte, UnsignedByte, maxInclusive, 256 );
+ INIT_ATOMIC_FACET( unsignedByte, UnsignedByte, minInclusive, 0 );
+ INIT_ATOMIC_FACET( unsignedInt, UnsignedInt, maxInclusive, 4294967295 );
+ INIT_ATOMIC_FACET( unsignedInt, UnsignedInt, minInclusive, 0 );
+ INIT_ATOMIC_FACET( unsignedLong, UnsignedLong, maxInclusive, 18446744073709551615UL );
+ INIT_ATOMIC_FACET( unsignedLong, UnsignedLong, minInclusive, 0 );
+ INIT_ATOMIC_FACET( unsignedShort, UnsignedShort, maxInclusive, 65536 );
+ INIT_ATOMIC_FACET( unsignedShort, UnsignedShort, minInclusive, 0 );
+
+ // TODO: add facets to other types
+#endif
+ }
+
+ map_type::const_iterator const i( m.find( type_name.c_str() ) );
+ if ( i != m.end() )
+ return i->second;
+ if ( not_found_error )
+ throw XQUERY_EXCEPTION( jsd::UNKNOWN_TYPE, ERROR_PARAMS( type_name ) );
+ return nullptr;
+}
+
+static kind find_kind( zstring const &name ) {
+ if ( ZSTREQ( name, "atomic" ) ) return k_atomic;
+ if ( ZSTREQ( name, "array" ) ) return k_array;
+ if ( ZSTREQ( name, "object" ) ) return k_object;
+ if ( ZSTREQ( name, "union" ) ) return k_union;
+ return k_none;
+}
+
+static store::Item_t get_value( store::Item_t const &jsd, char const *key ) {
+ zstring s( key );
+ store::Item_t key_item;
+ GENV_ITEMFACTORY->createString( key_item, s );
+ return jsd->getObjectValue( key_item );
+}
+
+static void make_invalid( char const *raise_file, int raise_line,
+ type const *expected_type,
+ store::Item_t const &instance,
+ store::Item_t *result,
+ Diagnostic const &diagnostic,
+ internal::diagnostic::parameters const ¶ms ) {
+ vector<store::Item_t> keys, values;
+ store::Item_t item;
+ zstring s;
+
+ append_item( "$invalid", &keys );
+ GENV_ITEMFACTORY->createBoolean( item, true );
+ values.push_back( item );
+
+ append_item( "$expected", &keys );
+ if ( expected_type->name_.empty() ) {
+ expected_type->to_json( &item );
+ } else {
+ s = expected_type->name_;
+ GENV_ITEMFACTORY->createString( item, s );
+ }
+ values.push_back( item );
+
+ append_item( "$value", &keys );
+ values.push_back( instance );
+
+ append_item( "$reason", &keys );
+ internal::diagnostic::parameters::value_type message( diagnostic.message() );
+ params.substitute( &message );
+ append_item( message, &values );
+
+#if INVALID_RAISE_LOCATION
+ append_item( "$raise-file", &keys );
+ append_item( fs::base_name( raise_file ), &values );
+
+ append_item( "$raise-line", &keys );
+ GENV_ITEMFACTORY->createInt( item, raise_line );
+ values.push_back( item );
+#endif /* NDEBUG */
+
+ GENV_ITEMFACTORY->createJSONObject( *result, keys, values );
+}
+
+static store::Item_t require_value( store::Item_t const &jsd, char const *key,
+ char const *type_name = "" ) {
+ store::Item_t value_item( get_value( jsd, key ) );
+ if ( !value_item )
+ throw XQUERY_EXCEPTION( jsd::MISSING_KEY, ERROR_PARAMS( key, type_name ) );
+ return value_item;
+}
+
+inline store::Item_t require_value( store::Item_t const &jsd, char const *key,
+ zstring const &type_name ) {
+ return require_value( jsd, key, type_name.c_str() );
+}
+
+static string to_type_str( store::Item_t const &item ) {
+ ostringstream oss;
+ if ( item->isAtomic() )
+ oss << item->getTypeCode();
+ else
+ oss << item->getKind();
+ return oss.str();
+}
+
+inline int to_xs_int( store::Item_t const &item ) {
+ return to_xs_int( item->getIntegerValue() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+constraint::constraint( zstring const &query ) :
+ query_( query ),
+ ccb_( get_shared_diagnostics() ),
+ sctx_( GENV_ROOT_STATIC_CONTEXT.create_child_context() )
+{
+ ccb_.theRootSctx = sctx_.get();
+ ccb_.theCommonLanguageEnabled = true;
+
+ // TODO: add explicit language parameter to XQueryCompiler::compile()
+ zstring temp( query_ );
+ temp.insert( 0, "jsoniq version \"1.0\";" );
+ istringstream iss( temp.c_str() );
+ zstring const no_filename;
+ ulong next_dynamic_var_id = 0; // TODO: is this correct?
+
+ XQueryCompiler xc( &ccb_ );
+ plan_ = xc.compile( iss, no_filename, next_dynamic_var_id );
+}
+
+constraint::constraint( constraint const &that ) :
+ query_( that.query_ ),
+ ccb_( that.ccb_ ),
+ plan_( that.plan_ ),
+ sctx_( that.sctx_ )
+{
+ // IMHO, CompilerCB( CompilerCB const& ) has a bug in that it does NOT copy
+ // the value of theRootSctx, so copy it ourselves.
+ ccb_.theRootSctx = that.ccb_.theRootSctx;
+}
+
+XQueryDiagnostics* constraint::get_shared_diagnostics() {
+ static XQueryDiagnostics diagnostics;
+ return &diagnostics;
+}
+
+bool constraint::validate( dynamic_context &dctx ) const {
+ PlanState state(
+ &dctx, &dctx, plan_->getStateSizeOfSubtree(), 0,
+ Properties::instance()->maxUdfCallDepth()
+ );
+ state.theCompilerCB = const_cast<CompilerCB*>( &ccb_ );
+ uint32_t offset = 0;
+ plan_->open( state, offset );
+ bool const valid = FnBooleanIterator::effectiveBooleanValue(
+ QueryLoc::null, state, plan_.get()
+ );
+ plan_->close( state );
+ return valid;
+}
+
+ostream& operator<<( ostream &os, kind k ) {
+ switch ( k ) {
+ case k_none : return os << "none";
+ case k_array : return os << "array";
+ case k_atomic: return os << "atomic";
+ case k_object: return os << "object";
+ case k_union : return os << "union";
+ default : return os << "<unknown kind: " << (int)k << '>';
+ }
+}
+
+ostream& operator<<( ostream &os, timezone::type tz ) {
+ using namespace timezone;
+ switch ( tz ) {
+ case prohibited: return os << "prohibited";
+ case required : return os << "required";
+ case optional : return os << "optional";
+ default : return os << "<unknown timezone::type: " << (int)tz << '>';
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+array_type::array_type() : min_max_type( k_array ) {
+ content_ = nullptr;
+}
+
+void array_type::assert_subtype_of( type const *t ) const {
+ DECL_dynamic_cast( array, cast_t, t );
+ content_->assert_subtype_of( cast_t->content_ );
+ ASSERT_SUBTYPE_FACET( array, t, maxLength, dt->maxLength_ <= bt->maxLength_ );
+ ASSERT_SUBTYPE_FACET( array, t, minLength, dt->minLength_ >= bt->minLength_ );
+}
+
+void array_type::load_content( store::Item_t const &content_item, schema &s ) {
+ ASSERT_KIND( content_item, "$content", ARRAY );
+ if ( content_item->getArraySize() != numeric_consts<xs_integer>::one() )
+ throw XQUERY_EXCEPTION( jsd::ILLEGAL_ARRAY_SIZE );
+ store::Item_t const type_item(
+ content_item->getArrayValue( numeric_consts<xs_integer>::one() )
+ );
+ content_ = s.find_or_create_type( type_item );
+}
+
+void array_type::load_type( store::Item_t const &type_item, schema &s ) {
+ ASSERT_KIND( type_item, "$type", OBJECT );
+ store::Iterator_t it( type_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( type_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$baseType" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$constraints" ) )
+ load_constraints( value_item );
+ else if ( ZSTREQ( key_str, "$content" ) )
+ load_content( value_item, s );
+ else if ( ZSTREQ( key_str, "$enumeration" ) )
+ load_enumeration( value_item );
+ else if ( ZSTREQ( key_str, "$maxLength" ) )
+ load_maxLength( value_item );
+ else if ( ZSTREQ( key_str, "$minLength" ) )
+ load_minLength( value_item );
+ else if ( ZSTREQ( key_str, "$kind" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$name" ) )
+ /* already handled */;
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY,
+ ERROR_PARAMS( key_str, ZED( ILLEGAL_KEY_Type_34o ), kind_, name_ )
+ );
+ } // while
+ it->close();
+
+ if ( !content_ ) {
+ if ( !baseType_ )
+ throw XQUERY_EXCEPTION(
+ jsd::MISSING_KEY,
+ ERROR_PARAMS( "$content", name_, ZED( MISSING_KEY_NoInherit ) )
+ );
+ DECL_baseType( array );
+ content_ = baseType->content_; // inherit baseType's content
+ }
+}
+
+bool array_type::validate( store::Item_t const &validate_item,
+ store::Item_t *result ) const {
+ VALIDATE_KIND( validate_item, ARRAY );
+ if ( !type::validate( validate_item, result ) )
+ return false;
+
+ DECL_FACET_type( array, this, maxLength );
+ DECL_FACET_type( array, this, minLength );
+ int length;
+ if ( minLength_type || maxLength_type )
+ length = to_xs_int( validate_item->getArraySize() );
+ VALIDATE_FACET( maxLength, length <= maxLength_type->maxLength_ );
+ VALIDATE_FACET( minLength, length >= minLength_type->minLength_ );
+
+ vector<store::Item_t> new_items;
+ bool valid = true;
+
+ store::Iterator_t it( validate_item->getArrayValues() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) )
+ if ( result ) {
+ store::Item_t temp;
+ if ( !content_->validate( item, &temp ) )
+ valid = false;
+ new_items.push_back( temp );
+ } else if ( !content_->validate( item ) )
+ return false;
+ it->close();
+
+ if ( result ) {
+ if ( valid )
+ *result = validate_item;
+ else
+ GENV_ITEMFACTORY->createJSONArray( *result, new_items );
+ }
+ return valid;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+atomic_type::atomic_type() : min_max_type( k_atomic ) {
+ explicitTimezone_ = timezone::optional;
+}
+
+void atomic_type::assert_min_max_facet( store::Item_t const &item,
+ char const *facet_name ) const {
+ switch ( schemaTypeCode_ ) {
+ case store::XS_DATE:
+ case store::XS_DATETIME:
+ case store::XS_DOUBLE:
+ case store::XS_DURATION:
+ case store::XS_FLOAT:
+ case store::XS_GDAY:
+ case store::XS_GMONTH:
+ case store::XS_GMONTH_DAY:
+ case store::XS_GYEAR:
+ case store::XS_GYEAR_MONTH:
+ case store::XS_TIME:
+ break;
+ default:
+ if ( !IS_SUBTYPE( schemaTypeCode_, XS_DECIMAL ) )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET, ERROR_PARAMS( facet_name, schemaTypeCode_ )
+ );
+ }
+ assert_type( item, facet_name, schemaTypeCode_ );
+}
+
+void atomic_type::assert_subtype_of( type const *t ) const {
+ DECL_dynamic_cast( atomic, cast_t, t );
+ if ( !TypeOps::is_subtype( schemaTypeCode_, cast_t->schemaTypeCode_ ) )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_BASE_TYPE,
+ ERROR_PARAMS(
+ t->name_, name_, ZED( ILLEGAL_BASE_TYPE_NotSubtype_45 ),
+ schemaTypeCode_, cast_t->schemaTypeCode_
+ )
+ );
+
+ ASSERT_SUBTYPE_FACET( atomic, t, maxExclusive,
+ dt->maxExclusive_->compare( bt->maxExclusive_ ) <= 0 );
+ ASSERT_SUBTYPE_FACET( atomic, t, maxInclusive,
+ dt->maxInclusive_->compare( bt->maxInclusive_ ) <= 0 );
+ ASSERT_SUBTYPE_FACET( atomic, t, minExclusive,
+ dt->minExclusive_->compare( bt->minExclusive_ ) >= 0 );
+ ASSERT_SUBTYPE_FACET( atomic, t, minInclusive,
+ dt->minInclusive_->compare( bt->minInclusive_ ) >= 0 );
+
+ ASSERT_SUBTYPE_FACET( atomic, t, minLength,
+ dt->minLength_ >= bt->minLength_ );
+ ASSERT_SUBTYPE_FACET( atomic, t, maxLength,
+ dt->maxLength_ <= bt->maxLength_ );
+
+ ASSERT_SUBTYPE_FACET( atomic, t, length, dt->length_ == bt->length_ );
+
+ ASSERT_SUBTYPE_FACET( atomic, t, totalDigits,
+ dt->totalDigits_ < bt->totalDigits_ );
+ ASSERT_SUBTYPE_FACET( atomic, t, fractionDigits,
+ dt->fractionDigits_ < bt->fractionDigits_ );
+
+ ASSERT_SUBTYPE_FACET( atomic, t, explicitTimezone,
+ dt->explicitTimezone_ == bt->explicitTimezone_ ||
+ bt->explicitTimezone_ == timezone::optional
+ );
+
+ // can't check whether pattern is a sub-pattern
+}
+
+void atomic_type::load_baseType( store::Item_t const &baseType_item,
+ schema const &s ) {
+ if ( !baseType_item )
+ throw XQUERY_EXCEPTION(
+ jsd::MISSING_KEY, ERROR_PARAMS( "$baseType", name_ )
+ );
+ type::load_baseType( baseType_item, s );
+ DECL_baseType( atomic );
+ schemaTypeCode_ = baseType ?
+ baseType->schemaTypeCode_ :
+ map_atomic_type( baseType_item->getStringValue() );
+}
+
+void atomic_type::load_explicitTimezone( store::Item_t const &eTz_item ) {
+ ASSERT_TYPE( eTz_item, "$explicitTimezone", XS_STRING );
+ switch ( schemaTypeCode_ ) {
+ case store::XS_DATE:
+ case store::XS_DATETIME:
+ case store::XS_TIME:
+ break;
+ default:
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET, ERROR_PARAMS( "$explicitTimezone", schemaTypeCode_ )
+ );
+ }
+ zstring const eTz_str( eTz_item->getStringValue() );
+ if ( ZSTREQ( eTz_str, "optional" ) )
+ explicitTimezone_ = timezone::optional;
+ else if ( ZSTREQ( eTz_str, "prohibited" ) )
+ explicitTimezone_ = timezone::prohibited;
+ else if ( ZSTREQ( eTz_str, "required" ) )
+ explicitTimezone_ = timezone::required;
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ eTz_str, "$explicitTimezone",
+ ZED( ILLEGAL_FACET_VALUE_MustBeOPR )
+ )
+ );
+ ASSERT_BASE_FACET( atomic, explicitTimezone,
+ explicitTimezone_ == bt->explicitTimezone_ ||
+ bt->explicitTimezone_ == timezone::optional
+ );
+ ADD_FACET( explicitTimezone );
+}
+
+void atomic_type::load_fractionDigits( store::Item_t const &fDigits_item ) {
+ ASSERT_TYPE( fDigits_item, "$fractionDigits", XS_INTEGER );
+ if ( schemaTypeCode_ != store::XS_DECIMAL )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET, ERROR_PARAMS( "$fractionDigits", schemaTypeCode_ )
+ );
+ fractionDigits_ = to_xs_int( fDigits_item );
+ if ( fractionDigits_ < 0 )
+ throw FACET_VALUE_EXCEPTION( fractionDigits, MustBeGE0 );
+
+ ASSERT_BASE_FACET( atomic, fractionDigits,
+ fractionDigits_ <= bt->fractionDigits_ );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, fractionDigits, totalDigits,
+ fractionDigits_ <= tt->totalDigits_ );
+
+ ADD_FACET( fractionDigits );
+}
+
+void atomic_type::load_length( store::Item_t const &length_item ) {
+ ASSERT_TYPE( length_item, "$length", XS_INTEGER );
+ switch ( schemaTypeCode_ ) {
+ case store::XS_ANY_URI:
+ case store::XS_BASE64BINARY:
+ case store::XS_HEXBINARY:
+ case store::XS_STRING:
+ break;
+ default:
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET, ERROR_PARAMS( "$length", schemaTypeCode_ )
+ );
+ }
+ length_ = to_xs_int( length_item );
+ if ( length_ < 0 )
+ throw FACET_VALUE_EXCEPTION( length, MustBeGE0 );
+ ASSERT_BASE_FACET( atomic, length, length_ <= bt->length_ );
+ ADD_FACET( length );
+}
+
+void atomic_type::load_maxExclusive( store::Item_t const &maxExclusive_item ) {
+ assert_min_max_facet( maxExclusive_item, "$maxExclusive" );
+ maxExclusive_ = maxExclusive_item;
+
+ ASSERT_BASE_FACET( atomic, maxExclusive,
+ maxExclusive_->compare( bt->maxExclusive_ ) <= 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxExclusive, maxInclusive,
+ maxExclusive_->compare( tt->maxInclusive_ ) > 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxExclusive, minExclusive,
+ maxExclusive_->compare( tt->minExclusive_ ) > 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxExclusive, minInclusive,
+ maxExclusive_->compare( tt->minInclusive_ ) > 0 );
+
+ ADD_FACET( maxExclusive );
+}
+
+void atomic_type::load_maxInclusive( store::Item_t const &maxInclusive_item ) {
+ assert_min_max_facet( maxInclusive_item, "$maxInclusive" );
+ maxInclusive_ = maxInclusive_item;
+
+ ASSERT_BASE_FACET( atomic, maxInclusive,
+ maxInclusive_->compare( bt->maxInclusive_ ) <= 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxInclusive, maxExclusive,
+ maxInclusive_->compare( tt->maxExclusive_ ) < 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxInclusive, minExclusive,
+ maxInclusive_->compare( tt->minExclusive_ ) > 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, maxInclusive, minInclusive,
+ maxInclusive_->compare( tt->minInclusive_ ) >= 0 );
+
+ ADD_FACET( maxInclusive );
+}
+
+void atomic_type::load_minExclusive( store::Item_t const &minExclusive_item ) {
+ assert_min_max_facet( minExclusive_item, "$minExclusive" );
+ minExclusive_ = minExclusive_item;
+
+ ASSERT_BASE_FACET( atomic, minExclusive,
+ minExclusive_->compare( bt->minExclusive_ ) >= 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minExclusive, maxExclusive,
+ minExclusive_->compare( tt->maxExclusive_ ) < 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minExclusive, maxInclusive,
+ minExclusive_->compare( tt->maxInclusive_ ) < 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minExclusive, minInclusive,
+ minExclusive_->compare( tt->minInclusive_ ) < 0 );
+
+ ADD_FACET( minExclusive );
+}
+
+void atomic_type::load_minInclusive( store::Item_t const &minInclusive_item ) {
+ assert_min_max_facet( minInclusive_item, "$minInclusive" );
+ minInclusive_ = minInclusive_item;
+
+ ASSERT_BASE_FACET( atomic, minInclusive,
+ minInclusive_->compare( bt->minInclusive_ ) >= 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minInclusive, maxExclusive,
+ minInclusive_->compare( tt->maxExclusive_ ) < 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minInclusive, maxInclusive,
+ minInclusive_->compare( tt->maxInclusive_ ) <= 0 );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, minInclusive, minExclusive,
+ minInclusive_->compare( tt->minExclusive_ ) > 0 );
+
+ ADD_FACET( minInclusive );
+}
+
+void atomic_type::load_pattern( store::Item_t const &pattern_item ) {
+ ASSERT_TYPE( pattern_item, "$pattern", XS_STRING );
+ zstring const xquery_re( pattern_item->getStringValue() );
+ try {
+ convert_xquery_re( xquery_re, &pattern_ );
+ pattern_re_.compile( pattern_ );
+ }
+ catch ( ZorbaException const &e ) {
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ xquery_re, "$pattern",
+ ZED( ILLEGAL_FACET_VALUE_BadPattern_45 ),
+ e.diagnostic().qname(), e.what()
+ )
+ );
+ }
+ ADD_FACET( pattern );
+}
+
+void atomic_type::load_totalDigits( store::Item_t const &totalDigits_item ) {
+ ASSERT_TYPE( totalDigits_item, "$totalDigits", XS_INTEGER );
+ if ( !IS_SUBTYPE( schemaTypeCode_, XS_DECIMAL ) )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET, ERROR_PARAMS( "$totalDigits", schemaTypeCode_ )
+ );
+ totalDigits_ = to_xs_int( totalDigits_item );
+ if ( totalDigits_ < 0 )
+ throw FACET_VALUE_EXCEPTION( totalDigits, MustBeGE0 );
+
+ ASSERT_BASE_FACET( atomic, totalDigits,
+ totalDigits_ <= bt->totalDigits_ );
+
+ ASSERT_COMPATIBLE_FACETS( atomic, totalDigits, fractionDigits,
+ totalDigits_ >= tt->fractionDigits_ );
+
+ ADD_FACET( totalDigits );
+}
+
+void atomic_type::load_type( store::Item_t const &type_item, schema &s ) {
+ store::Iterator_t it( type_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( type_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$about" ) )
+ load_about( value_item );
+ else if ( ZSTREQ( key_str, "$baseType" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$constraints" ) )
+ load_constraints( value_item );
+ else if ( ZSTREQ( key_str, "$enumeration" ) )
+ load_enumeration( value_item );
+ else if ( ZSTREQ( key_str, "$explicitTimezone" ) )
+ load_explicitTimezone( value_item );
+ else if ( ZSTREQ( key_str, "$fractionDigits" ) )
+ load_fractionDigits( value_item );
+ else if ( ZSTREQ( key_str, "$kind" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$length" ) )
+ load_length( value_item );
+ else if ( ZSTREQ( key_str, "$maxExclusive" ) )
+ load_maxExclusive( value_item );
+ else if ( ZSTREQ( key_str, "$maxInclusive" ) )
+ load_maxInclusive( value_item );
+ else if ( ZSTREQ( key_str, "$maxLength" ) )
+ load_maxLength( value_item );
+ else if ( ZSTREQ( key_str, "$minExclusive" ) )
+ load_minExclusive( value_item );
+ else if ( ZSTREQ( key_str, "$minInclusive" ) )
+ load_minInclusive( value_item );
+ else if ( ZSTREQ( key_str, "$minLength" ) )
+ load_minLength( value_item );
+ else if ( ZSTREQ( key_str, "$name" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$pattern" ) )
+ load_pattern( value_item );
+ else if ( ZSTREQ( key_str, "$totalDigits" ) )
+ load_totalDigits( value_item );
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY,
+ ERROR_PARAMS( key_str, ZED( ILLEGAL_KEY_Type_34o ), kind_, name_ )
+ );
+ } // while
+ it->close();
+}
+
+bool atomic_type::validate( store::Item_t const &validate_item,
+ store::Item_t *result ) const {
+ if ( !is_atomic_type( validate_item, schemaTypeCode_ ) )
+ RETURN_INVALID(
+ jsd::TYPE_VIOLATION,
+ ERROR_PARAMS( to_type_str( validate_item ), schemaTypeCode_ )
+ );
+ if ( !type::validate( validate_item, result ) )
+ return false;
+
+ zstring str;
+ int length;
+
+ DECL_FACET_type( atomic, this, length );
+ DECL_FACET_type( atomic, this, totalDigits );
+ DECL_FACET_type( atomic, this, fractionDigits );
+
+ if ( length_type || totalDigits_type || fractionDigits_type ) {
+ str = validate_item->getStringValue();
+ length = str.length();
+ }
+
+ if ( length_type )
+ VALIDATE_FACET( length, length == length_ );
+
+ if ( DECL_FACET_type( atomic, this, maxExclusive ) )
+ VALIDATE_FACET( maxExclusive,
+ validate_item->compare( maxExclusive_type->maxExclusive_ ) < 0 );
+
+ if ( DECL_FACET_type( atomic, this, maxInclusive ) )
+ VALIDATE_FACET( maxInclusive,
+ validate_item->compare( maxInclusive_type->maxInclusive_ ) <= 0 );
+
+ if ( DECL_FACET_type( atomic, this, minExclusive ) )
+ VALIDATE_FACET( minExclusive,
+ validate_item->compare( minExclusive_type->minExclusive_ ) > 0 );
+
+ if ( DECL_FACET_type( atomic, this, minInclusive ) )
+ VALIDATE_FACET( minInclusive,
+ validate_item->compare( minInclusive_type->minInclusive_ ) >= 0 );
+
+ zstring::size_type dot;
+ if ( totalDigits_type || fractionDigits_type )
+ dot = str.find( '.' );
+
+ if ( totalDigits_type ) {
+ int const digits = length - (dot != zstring::npos);
+ VALIDATE_FACET( totalDigits, digits == totalDigits_type->totalDigits_ );
+ }
+ if ( fractionDigits_type ) {
+ int const digits = dot == zstring::npos ? 0 : length - dot - 1;
+ VALIDATE_FACET( fractionDigits,
+ digits == fractionDigits_type->fractionDigits_ );
+ }
+
+ if ( DECL_FACET_type( atomic, this, pattern ) ) {
+ if ( str.empty() )
+ str = validate_item->getStringValue();
+ VALIDATE_FACET( pattern, pattern_type->pattern_re_.match_whole( str ) );
+ }
+
+ if ( DECL_FACET_type( atomic, this, explicitTimezone ) ) {
+ timezone::type const tz = explicitTimezone_type->explicitTimezone_;
+ if ( tz != timezone::optional ) {
+ xs_time const &time = validate_item->getTimeValue();
+ VALIDATE_FACET( explicitTimezone,
+ tz == timezone::required && time.hasTimezone() ||
+ tz == timezone::prohibited && !time.hasTimezone()
+ );
+ }
+ }
+
+ if ( result )
+ *result = validate_item;
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+min_max_type::min_max_type( kind k ) : type( k ) {
+}
+
+void min_max_type::load_maxLength( store::Item_t const &maxLength_item ) {
+ ASSERT_TYPE( maxLength_item, "$maxLength", XS_INTEGER );
+ maxLength_ = to_xs_int( maxLength_item );
+ if ( maxLength_ < 0 )
+ throw FACET_VALUE_EXCEPTION( maxLength, MustBeGE0 );
+ ASSERT_BASE_FACET( atomic, maxLength, maxLength_ <= bt->maxLength_ );
+ ADD_FACET( maxLength );
+}
+
+void min_max_type::load_minLength( store::Item_t const &minLength_item ) {
+ ASSERT_TYPE( minLength_item, "$minLength", XS_INTEGER );
+ minLength_ = to_xs_int( minLength_item );
+ if ( minLength_ < 0 )
+ throw FACET_VALUE_EXCEPTION( minLength, MustBeGE0 );
+ ASSERT_BASE_FACET( atomic, minLength, minLength_ >= bt->minLength_ );
+ ADD_FACET( minLength );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+object_type::field_descriptor::field_descriptor() {
+ type_ = nullptr;
+ optional_ = false;
+}
+
+void object_type::field_descriptor::
+load_default( store::Item_t const &default_item ) {
+ assert_type_matches( default_item, type_, "$default" );
+ default_ = default_item;
+}
+
+void object_type::field_descriptor::
+load_optional( store::Item_t const &optional_item ) {
+ ASSERT_TYPE( optional_item, "$optional", XS_BOOLEAN );
+ optional_ = optional_item->getBooleanValue();
+}
+
+void object_type::field_descriptor::
+load_type( store::Item_t const &type_item, schema &s ) {
+ type_ = s.find_or_create_type( type_item );
+}
+
+object_type::object_type() : type( k_object ) {
+ open_ = true;
+}
+
+void object_type::assert_subtype_of( type const *t ) const {
+ DECL_dynamic_cast( object, cast_t, t );
+ ASSERT_SUBTYPE_FACET( object, t, open, dt->open_ || !bt->open_ );
+ DECL_FACET_type( object, this, open );
+ bool const open = open_type ? open_type->open_ : true;
+ unordered_set<zstring> seen;
+ assert_subtype_of_helper( t, open, &seen );
+}
+
+void object_type::
+assert_subtype_of_helper( type const *t, bool open,
+ unordered_set<zstring> *seen ) const {
+ DECL_dynamic_cast( object, cast_t, t );
+ for ( type const *u = this; u; u = u->baseType_ ) {
+ DECL_static_cast( object, cast_u, u );
+ FOR_EACH( content_type, i, cast_u->content_ ) {
+ key_type const &key = i->first;
+ if ( ztd::contains( *seen, key ) )
+ continue;
+ field_descriptor const &fd = i->second;
+ content_type::const_iterator const t_i( cast_t->content_.find( key ) );
+ if ( t_i != cast_t->content_.end() ) {
+ field_descriptor const &t_fd = t_i->second;
+ if ( fd.optional_ && !t_fd.optional_ )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ "false", "$optional",
+ ZED( ILLEGAL_FACET_VALUE_NoOverrideBase_4 ),
+ t->name_
+ )
+ );
+ try {
+ fd.type_->assert_subtype_of( t_fd.type_ );
+ }
+ catch ( ZorbaException const &e ) {
+ catch_helper( e, t, key );
+ }
+ } else if ( t->baseType_ ) {
+ cast_u->assert_subtype_of_helper( t->baseType_, open, seen );
+ seen->insert( key );
+ } else if ( !open )
+ throw XQUERY_EXCEPTION(
+ jsd::NEW_KEY_NOT_ALLOWED,
+ ERROR_PARAMS( key, t->name_ )
+ );
+ } // FOR_EACH
+ } // for
+}
+
+void object_type::catch_helper( ZorbaException const &e,
+ type const *illegal_base_type,
+ zstring const &key ) const {
+ if ( strcmp( e.diagnostic().qname().ns(), JSOUND_ERR_NS ) != 0 )
+ throw;
+ //
+ // Give a better error message by throwing an exception specific to the
+ // current key with the original exception's error message as a sub-message.
+ //
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_BASE_TYPE,
+ ERROR_PARAMS(
+ illegal_base_type->name_, name_,
+ ZED( ILLEGAL_BASE_TYPE_BecauseOfKey_45 ),
+ key, e.what()
+ )
+ );
+}
+
+void object_type::load_content( store::Item_t const &content_item, schema &s ) {
+ ASSERT_KIND( content_item, "$content", OBJECT );
+
+ DECL_FACET_type( object, this, open );
+ bool const open = open_type ? open_type->open_ : true;
+
+ store::Iterator_t it( content_item->getObjectKeys() );
+ store::Item_t key_item;
+ it->open();
+ while ( it->next( key_item ) ) {
+ // key_item is guaranteed to be a string by JSON syntax
+ zstring const key_str( key_item->getStringValue() );
+ // duplicate keys in the same object are checked for by JSON semantics
+ field_descriptor &fd = content_[ key_str ];
+ load_field_descriptor( content_item->getObjectValue( key_item ), s, &fd );
+
+ //
+ // Check every base type for the same key: if found, it's value's type must
+ // be a subtype of this key's value's type; if not found and the base type
+ // isn't open, thrown an exception.
+ //
+ for ( type const *t = baseType_; t; t = t->baseType_ ) {
+ DECL_static_cast( object, cast_t, t );
+ content_type::const_iterator bt_i( cast_t->content_.find( key_str ) );
+ if ( bt_i != cast_t->content_.end() )
+ try {
+ fd.type_->assert_subtype_of( bt_i->second.type_ );
+ }
+ catch ( ZorbaException const &e ) {
+ catch_helper( e, t, key_str );
+ }
+ else if ( !open )
+ throw XQUERY_EXCEPTION(
+ jsd::NEW_KEY_NOT_ALLOWED,
+ ERROR_PARAMS( key_str, t->name_ )
+ );
+ } // for
+ } // while
+ it->close();
+}
+
+void object_type::load_field_descriptor( store::Item_t const &field_item,
+ schema &s, field_descriptor *fd ) {
+ ASSERT_KIND( field_item, "field descriptor", OBJECT );
+ store::Item_t const type_item( require_value( field_item, "$type", name_ ) );
+ fd->load_type( type_item, s );
+
+ store::Iterator_t it( field_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( field_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$default" ) )
+ fd->load_default( value_item );
+ else if ( ZSTREQ( key_str, "$optional" ) )
+ fd->load_optional( value_item );
+ else if ( ZSTREQ( key_str, "$type" ) )
+ /* already handled */;
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY,
+ ERROR_PARAMS( key_str, ZED( ILLEGAL_KEY_FieldDescriptor ) )
+ );
+ } // while
+ it->close();
+}
+
+void object_type::load_open( store::Item_t const &open_item ) {
+ ASSERT_TYPE( open_item, "$open", XS_BOOLEAN );
+ open_ = open_item->getBooleanValue();
+ DECL_FACET_type( object, this, open );
+ if ( open_type && !open_type->open_ && open_ ) {
+ //
+ // JSound 5.4: The $open Facet behaves like most Facets, i.e., if that of
+ // the Base Type is false, it cannot be set back to true, otherwise
+ // jsd:JDST0007 is raised.
+ //
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ "true", "$open", ZED( ILLEGAL_FACET_VALUE_NoOverrideBase_4 ), "false"
+ )
+ );
+ }
+ ADD_FACET( open );
+}
+
+void object_type::load_type( store::Item_t const &type_item, schema &s ) {
+ store::Iterator_t it( type_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( type_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$baseType" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$constraints" ) )
+ load_constraints( value_item );
+ else if ( ZSTREQ( key_str, "$content" ) )
+ load_content( value_item, s );
+ else if ( ZSTREQ( key_str, "$enumeration" ) )
+ load_enumeration( value_item );
+ else if ( ZSTREQ( key_str, "$kind" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$name" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$open" ) )
+ load_open( value_item );
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY,
+ ERROR_PARAMS( key_str, ZED( ILLEGAL_KEY_Type_34o ), kind_, name_ )
+ );
+ } // while
+ it->close();
+
+ if ( content_.empty() ) {
+ if ( !baseType_ )
+ throw XQUERY_EXCEPTION(
+ jsd::MISSING_KEY,
+ ERROR_PARAMS( "$content", name_, ZED( MISSING_KEY_NoInherit ) )
+ );
+ DECL_baseType( object );
+ content_ = baseType->content_; // inherit baseType's content
+ }
+}
+
+bool object_type::validate( store::Item_t const &validate_item,
+ store::Item_t *result ) const {
+ VALIDATE_KIND( validate_item, OBJECT );
+ if ( !type::validate( validate_item, result ) )
+ return false;
+
+ typedef unordered_set<zstring> seen_type;
+
+ seen_type seen;
+ vector<store::Item_t> new_keys, new_values;
+ bool added_default = false, valid = true;
+
+ DECL_FACET_type( object, this, open );
+ bool const open = open_type ? open_type->open_ : true;
+
+ //
+ // Check each key in the given object against this type.
+ //
+ store::Iterator_t it( validate_item->getObjectKeys() );
+ store::Item_t key_item;
+ it->open();
+ while ( it->next( key_item ) ) {
+ zstring const key_str( key_item->getStringValue() );
+ field_descriptor const *fd = nullptr;
+ for ( type const *t = this; t; t = t->baseType_ ) {
+ DECL_static_cast( object, cast_t, t );
+ content_type::const_iterator const i( cast_t->content_.find( key_str ) );
+ if ( i != cast_t->content_.end() ) {
+ fd = &i->second;
+ break;
+ }
+ } // for
+ if ( !fd ) {
+ if ( open )
+ continue;
+ RETURN_INVALID(
+ jsd::FACET_VIOLATION,
+ ERROR_PARAMS(
+ ZED( FACET_VIOLATION_BadKey_23o ),
+ key_str, open_type->name_
+ )
+ );
+ }
+
+ store::Item_t const value_item( validate_item->getObjectValue( key_item ) );
+ if ( result ) {
+ store::Item_t temp;
+ if ( !fd->type_->validate( value_item, &temp ) )
+ valid = false;
+ new_keys.push_back( key_item );
+ new_values.push_back( temp );
+ } else if ( !fd->type_->validate( value_item ) )
+ return false;
+ seen.insert( key_str );
+ } // while
+ it->close();
+
+ //
+ // Check each key in this type against the given object: look for keys that
+ // aren't present.
+ //
+ for ( type const *t = this; t; t = t->baseType_ ) {
+ DECL_static_cast( object, cast_t, t );
+ FOR_EACH( content_type, i, cast_t->content_ ) {
+ zstring const &key_str = i->first;
+ field_descriptor const &fd = i->second;
+ seen_type::const_iterator const j( seen.find( key_str ) );
+ if ( j != seen.end() )
+ continue;
+ if ( result && !!fd.default_ ) {
+ //
+ // The key isn't present and there is a default value: add it.
+ //
+ append_item( key_str, &new_keys );
+ new_values.push_back( fd.default_ );
+ added_default = true;
+ //
+ // Add the key to "seen" so that we don't add a default value again in
+ // the case where a base type has the same key.
+ //
+ seen.insert( key_str );
+ continue;
+ }
+ if ( !fd.optional_ ) {
+ //
+ // The key isn't present and it's not optional: invalid.
+ //
+ valid = false;
+ if ( !result )
+ break;
+ append_item( key_str, &new_keys );
+ store::Item_t item, null_item;
+ GENV_ITEMFACTORY->createJSONNull( null_item );
+ MAKE_INVALID(
+ fd.type_, null_item, &item,
+ jsd::MISSING_KEY, ERROR_PARAMS( key_str, fd.type_->name_ )
+ );
+ new_values.push_back( item );
+ }
+ } // FOR_EACH
+ } // for
+
+ if ( result ) {
+ if ( valid && !added_default )
+ *result = validate_item;
+ else
+ GENV_ITEMFACTORY->createJSONObject( *result, new_keys, new_values );
+ }
+ return valid;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+type::type( kind k ) : kind_( k ) {
+ baseType_ = nullptr;
+ facet_mask_ = 0;
+}
+
+type::~type() {
+ // out-of-line since it's virtual
+}
+
+type const* type::find_facet( facet_mask facet ) const {
+ for ( type const *t = this; t; t = t->baseType_ )
+ if ( t->facet_mask_ & facet )
+ return t;
+ return nullptr;
+}
+
+bool type::is_enum_valid( store::Item_t const &item ) const {
+ FOR_EACH( enumeration_type, i, enumeration_ )
+ if ( item->compare( *i ) == 0 )
+ return true;
+ return baseType_ ? baseType_->is_enum_valid( item ) : false;
+}
+
+void type::load_about( store::Item_t const &about_item ) {
+ ASSERT_TYPE( about_item, "$about", XS_STRING );
+ about_ = about_item->getStringValue();
+}
+
+void type::load_baseType( store::Item_t const &baseType_item,
+ schema const &s ) {
+ if ( !baseType_item )
+ return;
+ ASSERT_TYPE( baseType_item, "$baseType", XS_STRING );
+ zstring const baseType_str( baseType_item->getStringValue() );
+ if ( kind const k = find_kind( baseType_str ) ) {
+ //
+ // The case where the kind of the base type of "array", "atomic", "object",
+ // or "union" is specified explicitly ...
+ //
+ if ( k != kind_ ) {
+ //
+ // ... and does NOT match the kind of this type.
+ //
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_BASE_TYPE,
+ ERROR_PARAMS( k, name_, ZED( ILLEGAL_BASE_TYPE_MustBeX_4 ), kind_ )
+ );
+ }
+ return;
+ }
+
+ zstring fq_baseType_str( baseType_str );
+ type const *const baseType = s.fq_find_type( &fq_baseType_str );
+
+ if ( baseType->kind_ != kind_ )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_BASE_TYPE,
+ ERROR_PARAMS(
+ fq_baseType_str, name_, ZED( ILLEGAL_BASE_TYPE_MustBeX_4 ), kind_
+ )
+ );
+ baseType_ = baseType;
+}
+
+void type::load_constraints( store::Item_t const &constraints_item ) {
+ ASSERT_KIND( constraints_item, "$constraints", ARRAY );
+ store::Iterator_t it( constraints_item->getArrayValues() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ ASSERT_TYPE( item, "constraint", XS_STRING );
+ zstring const constraint_str( item->getStringValue() );
+ try {
+ constraint c( constraint_str );
+ constraints_.push_back( c );
+ }
+ catch ( ZorbaException const &e ) {
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ constraint_str, "$constraints",
+ ZED( ILLEGAL_FACET_VALUE_BadConstraint_45 ),
+ e.diagnostic().qname(), e.what()
+ )
+ );
+ }
+ } // while
+ it->close();
+ ADD_FACET( constraints );
+}
+
+void type::load_enumeration( store::Item_t const &enumeration_item ) {
+ ASSERT_KIND( enumeration_item, "$enumeration", ARRAY );
+ store::Iterator_t it( enumeration_item->getArrayValues() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ assert_type_matches( item, baseType_ );
+ if ( DECL_FACET_type( type, this, enumeration ) ) {
+ bool found = false;
+ FOR_EACH( enumeration_type, i, enumeration_type->enumeration_ ) {
+ if ( item->compare( *i ) == 0 ) {
+ found = true;
+ break;
+ }
+ }
+ if ( !found )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS(
+ item->toString(), "$enumeration",
+ ZED( ILLEGAL_FACET_VALUE_NoAddEnum_4 ),
+ enumeration_type->name_
+ )
+ );
+ }
+ enumeration_.push_back( item );
+ } // while
+ it->close();
+ ADD_FACET( enumeration );
+}
+
+void type::load_name( store::Item_t const &name_item, schema const &s ) {
+ ASSERT_TYPE( name_item, "$name", XS_STRING );
+ zstring fq_name_str( name_item->getStringValue() );
+ zstring uri;
+ s.fq_type_name( &fq_name_str, &uri );
+ if ( !uri.empty() && uri != s.get_namespace() )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_NAMESPACE,
+ ERROR_PARAMS( fq_name_str, s.get_namespace() )
+ );
+ if ( s.find_type( fq_name_str, false ) )
+ throw XQUERY_EXCEPTION( jsd::DUPLICATE_TYPE, ERROR_PARAMS( fq_name_str ) );
+ name_ = fq_name_str;
+}
+
+void type::to_json( store::Item_t *result ) const {
+ store::Item_t item;
+ vector<store::Item_t> keys, values;
+ ostringstream oss;
+ zstring s;
+
+ append_item( "$name", &keys );
+ append_item( name_.empty() ? "<anonymous>" : name_.c_str(), &values );
+
+ append_item( "$kind", &keys );
+ oss << kind_;
+ append_item( oss.str(), &values );
+
+ if ( baseType_ && !baseType_->name_.empty() ) {
+ append_item( "$baseType", &keys );
+ append_item( baseType_->name_, &values );
+ }
+
+ if ( DECL_FACET_type( atomic, this, explicitTimezone ) ) {
+ append_item( "$explicitTimezone", &keys );
+ oss << explicitTimezone_type->explicitTimezone_;
+ append_item( oss.str(), &values );
+ }
+ if ( DECL_FACET_type( atomic, this, fractionDigits ) ) {
+ append_item( "$fractionDigits", &keys );
+ GENV_ITEMFACTORY->createInteger(
+ item, xs_integer( fractionDigits_type->fractionDigits_ )
+ );
+ values.push_back( item );
+ }
+ if ( DECL_FACET_type( atomic, this, maxExclusive ) ) {
+ append_item( "$maxExclusive", &keys );
+ values.push_back( maxExclusive_type->maxExclusive_ );
+ }
+ if ( DECL_FACET_type( atomic, this, maxInclusive ) ) {
+ append_item( "$maxInclusive", &keys );
+ values.push_back( maxInclusive_type->maxInclusive_ );
+ }
+ if ( DECL_FACET_type( min_max, this, maxLength ) ) {
+ append_item( "$maxLength", &keys );
+ GENV_ITEMFACTORY->createInteger(
+ item, xs_integer( maxLength_type->maxLength_ )
+ );
+ values.push_back( item );
+ }
+ if ( DECL_FACET_type( atomic, this, minInclusive ) ) {
+ append_item( "$minInclusive", &keys );
+ values.push_back( minInclusive_type->minInclusive_ );
+ }
+ if ( DECL_FACET_type( atomic, this, minExclusive ) ) {
+ append_item( "$minExclusive", &keys );
+ values.push_back( minExclusive_type->minExclusive_ );
+ }
+ if ( DECL_FACET_type( min_max, this, minLength ) ) {
+ append_item( "$minLength", &keys );
+ GENV_ITEMFACTORY->createInteger(
+ item, xs_integer( minLength_type->minLength_ )
+ );
+ values.push_back( item );
+ }
+ if ( DECL_FACET_type( object, this, open ) ) {
+ append_item( "$open", &keys );
+ GENV_ITEMFACTORY->createBoolean( item, open_type->open_ );
+ values.push_back( item );
+ }
+ if ( DECL_FACET_type( atomic, this, pattern ) ) {
+ append_item( "$pattern", &keys );
+ s = pattern_type->pattern_;
+ GENV_ITEMFACTORY->createString( item, s );
+ values.push_back( item );
+ }
+ if ( DECL_FACET_type( atomic, this, totalDigits ) ) {
+ append_item( "$totalDigits", &keys );
+ GENV_ITEMFACTORY->createInteger(
+ item, xs_integer( totalDigits_type->totalDigits_ )
+ );
+ values.push_back( item );
+ }
+
+ GENV_ITEMFACTORY->createJSONObject( *result, keys, values );
+}
+
+bool type::validate( store::Item_t const &validate_item,
+ store::Item_t *result ) const {
+ DECL_FACET_type( type, this, enumeration );
+ VALIDATE_FACET( enumeration,
+ enumeration_type->is_enum_valid( validate_item ) );
+
+ if ( DECL_FACET_type( type, this, constraints ) ) {
+ dynamic_context dctx;
+ store::Item_t ctx_item( validate_item );
+ dctx.add_variable( dynamic_context::IDVAR_CONTEXT_ITEM, ctx_item );
+
+ // we need these in the catch() clause below
+ zstring const *query;
+ type const *t;
+
+ try {
+ for ( t = constraints_type; t; t = t->baseType_ ) {
+ FOR_EACH( constraints_type, c, t->constraints_ ) {
+ query = &c->query_;
+ if ( !c->validate( dctx ) )
+ RETURN_INVALID(
+ jsd::FACET_VIOLATION,
+ ERROR_PARAMS(
+ ZED( FACET_VIOLATION_BadConstraint_23o4o5o ),
+ c->query_, t->name_
+ )
+ );
+ } // FOR_EACH
+ } // for
+ }
+ catch ( ZorbaException const &e ) {
+ RETURN_INVALID(
+ jsd::FACET_VIOLATION,
+ ERROR_PARAMS(
+ ZED( FACET_VIOLATION_BadConstraint_23o4o5o ),
+ *query, t->name_,
+ e.diagnostic().qname(), e.what()
+ )
+ );
+ }
+ } // if
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+union_type::union_type() : type( k_union ) {
+}
+
+void union_type::assert_subtype_of( type const *t ) const {
+ DECL_dynamic_cast( union, cast_t, t );
+ FOR_EACH( content_type, u, content_ )
+ (*u)->assert_subtype_of( t );
+}
+
+void union_type::load_content( store::Item_t const &content_item, schema &s ) {
+ ASSERT_KIND( content_item, "$content", ARRAY );
+ store::Iterator_t it( content_item->getArrayValues() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) )
+ content_.push_back( s.find_or_create_type( item ) );
+ it->close();
+}
+
+void union_type::load_type( store::Item_t const &type_item, schema &s ) {
+ ASSERT_KIND( type_item, "$type", OBJECT );
+ load_content( require_value( type_item, "$content", name_ ), s );
+ store::Iterator_t it( type_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( type_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$constraints" ) )
+ load_constraints( value_item );
+ else if ( ZSTREQ( key_str, "$content" ) )
+ load_content( value_item, s );
+ else if ( ZSTREQ( key_str, "$enumeration" ) )
+ load_enumeration( value_item );
+ else if ( ZSTREQ( key_str, "$kind" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$name" ) )
+ /* already handled */;
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY,
+ ERROR_PARAMS( key_str, ZED( ILLEGAL_KEY_Type_34o ), kind_, name_ )
+ );
+ } // while
+ it->close();
+
+ if ( content_.empty() ) {
+ if ( !baseType_ )
+ throw XQUERY_EXCEPTION(
+ jsd::MISSING_KEY,
+ ERROR_PARAMS( "$content", name_, ZED( MISSING_KEY_NoInherit ) )
+ );
+ DECL_baseType( union );
+ content_ = baseType->content_; // inherit baseType's content
+ }
+}
+
+bool union_type::validate( store::Item_t const &validate_item,
+ store::Item_t *result ) const {
+ if ( !type::validate( validate_item, result ) )
+ return false;
+ //
+ // We can't pass "result" to nested called of validate() because:
+ //
+ // * Typically, N-1 validations will fail, so we don't want N-1 annotation
+ // objects created for no reason (since we can't use them anyway).
+ //
+ // * However, we still have to pass some temporary result object to the
+ // nested calls since the 1 validation that succeeds might fill in default
+ // value(s).
+ //
+ // * But, we don't have to pass a temporary object if we're just validating
+ // and not annotating.
+ //
+ store::Item_t temp, *const temp_ptr = result ? &temp : nullptr;
+ FOR_EACH( content_type, i, content_ )
+ if ( (*i)->validate( validate_item, temp_ptr ) ) {
+ if ( result )
+ result->transfer( temp );
+ return true;
+ }
+ RETURN_INVALID(
+ jsd::TYPE_VIOLATION,
+ ERROR_PARAMS(
+ to_type_str( validate_item ), ZED( TYPE_VIOLATION_UnionMemberType )
+ )
+ );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+schema::schema( store::Item_t const &jsd_item, static_context const *sctx ) :
+ sctx_( sctx )
+{
+ ZORBA_ASSERT( sctx );
+ ASSERT_KIND( jsd_item, "JSound", OBJECT );
+ load_namespace( require_value( jsd_item, "$namespace" ) );
+ store::Item_t item( get_value( jsd_item, "$imports" ) );
+ if ( !!item )
+ load_imports( item );
+ load_types( require_value( jsd_item, "$types" ) );
+}
+
+schema::~schema() {
+ ztd::delete_ptr_seq( types_ );
+}
+
+type const* schema::find_or_create_type( store::Item_t const &type_item ) {
+ if ( IS_ATOMIC_TYPE( type_item, XS_STRING ) ) {
+ zstring fq_name_str( type_item->getStringValue() );
+ return fq_find_type( &fq_name_str );
+ }
+ if ( IS_KIND( type_item, OBJECT ) )
+ return load_type( type_item );
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_TYPE,
+ ERROR_PARAMS( type_item->getKind(), "$content", "string", "object" )
+ );
+}
+
+type const* schema::find_type( zstring const &type_name,
+ bool not_found_error ) const {
+ if ( type const *const t = find_builtin_atomic_type( type_name, false ) )
+ return t;
+ if ( type_name.compare( 0, 2, "Q{" ) == 0 ) {
+ name_type_map::const_iterator const i( name_type_.find( type_name ) );
+ if ( i != name_type_.end() )
+ return i->second;
+ }
+ if ( not_found_error )
+ throw XQUERY_EXCEPTION( jsd::UNKNOWN_TYPE, ERROR_PARAMS( type_name ) );
+ return nullptr;
+}
+
+type const* schema::fq_find_type( zstring *type_name,
+ bool not_found_error ) const {
+ fq_type_name( type_name );
+ return find_type( *type_name, not_found_error );
+}
+
+void schema::fq_type_name( zstring *type_name, zstring *uri ) const {
+ zstring prefix, local, func_local_uri;
+ if ( !uri )
+ uri = &func_local_uri;
+
+ if ( xml::split_qname( *type_name, &prefix, &local ) && !prefix.empty() ) {
+ prefix_namespace_map::const_iterator const i( prefix_ns_.find( prefix ) );
+ if ( i == prefix_ns_.end() )
+ throw XQUERY_EXCEPTION( jsd::UNKNOWN_PREFIX, ERROR_PARAMS( prefix ) );
+ *type_name = "Q{" + i->second + '}' + local;
+ } else if ( xml::split_uri_name( *type_name, uri, &local ) ) {
+ // Do nothing since type_name is already a URIQualifiedName.
+ } else {
+ if ( !find_builtin_atomic_type( *type_name, false ) )
+ *type_name = "Q{" + namespace_ + '}' + *type_name;
+ }
+}
+
+void schema::import( zstring const &ns, schema *s ) {
+ FOR_EACH( namespace_set, i, s->namespaces_ )
+ namespaces_.insert( *i );
+ FOR_EACH( type_list, i, s->types_ )
+ types_.push_back( *i );
+ s->types_.clear();
+ FOR_EACH( name_type_map, i, s->name_type_ )
+ name_type_[ i->first ] = i->second;
+}
+
+void schema::load_import( store::Item_t const &import_item ) {
+ ASSERT_KIND( import_item, "import", OBJECT );
+
+ store::Item_t const ns_item( require_value( import_item, "$namespace" ) );
+ ASSERT_TYPE( ns_item, "$namespace", XS_STRING );
+ zstring const ns_str( ns_item->getStringValue() );
+
+ store::Item_t const prefix_item( require_value( import_item, "$prefix" ) );
+ ASSERT_TYPE( prefix_item, "$prefix", XS_STRING );
+ zstring const prefix_str( prefix_item->getStringValue() );
+ if ( prefix_str.find( ':' ) != zstring::npos )
+ throw XQUERY_EXCEPTION( jsd::ILLEGAL_PREFIX, ERROR_PARAMS( prefix_str ) );
+ if ( ztd::contains( prefix_ns_, prefix_str ) )
+ throw XQUERY_EXCEPTION( jsd::DUPLICATE_PREFIX, ERROR_PARAMS( prefix_str ) );
+
+ prefix_ns_[ prefix_str ] = ns_str;
+ if ( ztd::contains( namespaces_, ns_str ) )
+ return; // already imported
+
+ zstring location_str;
+ vector<zstring> schema_uris;
+
+ store::Iterator_t it( import_item->getObjectKeys() );
+ store::Item_t item;
+ it->open();
+ while ( it->next( item ) ) {
+ zstring const key_str( item->getStringValue() );
+ store::Item_t const value_item( import_item->getObjectValue( item ) );
+ if ( ZSTREQ( key_str, "$location" ) ) {
+ ASSERT_TYPE( value_item, "$location", XS_STRING );
+ location_str = value_item->getStringValue();
+ schema_uris.push_back( sctx_->resolve_relative_uri( location_str ) );
+ } else if ( ZSTREQ( key_str, "$namespace" ) )
+ /* already handled */;
+ else if ( ZSTREQ( key_str, "$prefix" ) )
+ /* already handled */;
+ else
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_KEY, ERROR_PARAMS( key_str, "import" )
+ );
+ } // while
+ it->close();
+
+ schema_uris.push_back( ns_str );
+
+ unique_ptr<internal::Resource> rsrc;
+ internal::StreamResource *stream_rsrc = nullptr;
+ zstring error_msg;
+ FOR_EACH( vector<zstring>, i, schema_uris ) {
+ rsrc = sctx_->resolve_uri( *i, internal::EntityData::SCHEMA, error_msg );
+ stream_rsrc = dynamic_cast<internal::StreamResource*>( rsrc.get() );
+ if ( stream_rsrc )
+ break;
+ }
+ if ( !stream_rsrc )
+ throw XQUERY_EXCEPTION(
+ jsd::SCHEMA_NOT_FOUND,
+ ERROR_PARAMS( ns_str, location_str, error_msg )
+ );
+ json::loader loader( *stream_rsrc->getStream() );
+ store::Item_t jsd;
+ try {
+ if ( !loader.next( &jsd ) )
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_SCHEMA,
+ ERROR_PARAMS( ns_str, location_str )
+ );
+ schema schema_to_import( jsd, sctx_ );
+ import( ns_str, &schema_to_import );
+ }
+ catch ( ZorbaException const &e ) {
+ if ( e.diagnostic().qname() != "{" JSONIQ_ERR_NS "}" "JNDY0021" )
+ throw;
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_SCHEMA,
+ ERROR_PARAMS( ns_str, location_str, e.diagnostic().qname(), e.what() )
+ );
+ }
+}
+
+void schema::load_imports( store::Item_t const &imports_item ) {
+ ASSERT_KIND( imports_item, "$imports", ARRAY );
+ store::Iterator_t it( imports_item->getArrayValues() );
+ store::Item_t import_item;
+ it->open();
+ while ( it->next( import_item ) )
+ load_import( import_item );
+ it->close();
+}
+
+void schema::load_namespace( store::Item_t const &namespace_item ) {
+ ASSERT_TYPE( namespace_item, "$namespace", XS_STRING );
+ namespace_ = namespace_item->getStringValue();
+}
+
+void schema::load_top_type( store::Item_t const &type_item ) {
+ store::Item_t const name_item( require_value( type_item, "$name" ) );
+ type const *const t = load_type( type_item );
+ zstring fq_name_str( name_item->getStringValue() );
+ fq_type_name( &fq_name_str );
+ name_type_[ fq_name_str ] = t;
+}
+
+type const* schema::load_type( store::Item_t const &type_item ) {
+ type *const t = new_type( require_value( type_item, "$kind" ) );
+ store::Item_t const name_item( get_value( type_item, "$name" ) );
+ if ( !!name_item ) {
+ // load name first so it's available for error messages
+ t->load_name( name_item, *this );
+ }
+ t->load_baseType( get_value( type_item, "$baseType" ), *this );
+ t->load_type( type_item, *this );
+ return t;
+}
+
+void schema::load_types( store::Item_t const &types_item ) {
+ ASSERT_KIND( types_item, "$types", ARRAY );
+ store::Iterator_t it( types_item->getArrayValues() );
+ store::Item_t type_item;
+ it->open();
+ while ( it->next( type_item ) )
+ load_top_type( type_item );
+ it->close();
+}
+
+type* schema::new_type( store::Item_t const &kind_item ) {
+ ASSERT_TYPE( kind_item, "$kind", XS_STRING );
+ zstring const kind_str( kind_item->getStringValue() );
+ unique_ptr<type> t;
+ switch ( find_kind( kind_str ) ) {
+ case k_atomic: t.reset( new atomic_type ); break;
+ case k_array : t.reset( new array_type ); break;
+ case k_object: t.reset( new object_type ); break;
+ case k_union : t.reset( new union_type ); break;
+ default:
+ throw XQUERY_EXCEPTION(
+ jsd::ILLEGAL_FACET_VALUE,
+ ERROR_PARAMS( kind_str, "$kind", ZED( ILLEGAL_FACET_VALUE_MustBeAAOU ) )
+ );
+ } // switch
+ types_.push_back( t.get() );
+ return t.release();
+}
+
+bool schema::validate( store::Item_t const &json, char const *type_name,
+ store::Item_t *result ) const {
+ zstring fq_name_str( type_name );
+ return fq_find_type( &fq_name_str )->validate( json, result );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace jsound
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */
=== added file 'src/runtime/jsound/jsound_util.h'
--- src/runtime/jsound/jsound_util.h 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/jsound_util.h 2013-12-06 05:12:46 +0000
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2006-2013 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+
+#include <vector>
+
+#include "store/api/item.h"
+#include "util/hash/hash.h"
+#include "util/unordered_map.h"
+#include "util/unordered_set.h"
+#include "zorbatypes/zstring.h"
+
+namespace zorba {
+
+class static_context;
+
+namespace jsound {
+
+class type;
+
+///////////////////////////////////////////////////////////////////////////////
+
+class schema {
+public:
+ /**
+ * Constructs a %schema.
+ *
+ * @param jsd The JSound (JSON Schema Document) to load and utlimiately
+ * annotate or validate against.
+ * @param sctx The static_context to use.
+ */
+ schema( store::Item_t const &jsd, static_context const *sctx );
+
+ /**
+ * Destroys a %schema.
+ */
+ ~schema();
+
+ /**
+ * Gets the namespace of the loaded JSound schema.
+ *
+ * @return Returns said namespace.
+ */
+ zstring const& get_namespace() const {
+ return namespace_;
+ }
+
+ /**
+ * Validates a JSON object against a type of a JSound schema.
+ * If \a result is not null, then it is set to a validated instance
+ * of \a json.
+ * If \a json is valid, then \a result will be a copy of \a json
+ * with the default values, if any, filled in.
+ * If \a json is not valid, then \a result will be a copy of \a json
+ * except each invalid item will be replaced by an object of the form:
+ * <code>
+ * {
+ * "$invalid" : true,
+ * "$expected" : <i>type-name</i>,
+ * "$value" : <i>invalid-value</i>,
+ * "$reason" : "<i>reason the item is invalid</i>"
+ * }
+ * </code>
+ *
+ * @param json The JSON object to validate.
+ * @param type_name The type to validate \a json against.
+ * @param result A pointer to an item to receive the validated JSON object or
+ * null for none.
+ * @return Returns \c true only if \a json is valid against this schema.
+ */
+ bool validate( store::Item_t const &json, char const *type_name,
+ store::Item_t *result = nullptr ) const;
+
+ /**
+ * Validates a JSON object against a type of a JSound schema.
+ * If \a result is not null, then it is set to a validated instance
+ * of \a json.
+ * If \a json is valid, then \a result will be a copy of \a json
+ * with the default values, if any, filled in.
+ * If \a json is not valid, then \a result will be a copy of \a json
+ * except each invalid item will be replaced by an object of the form:
+ * <code>
+ * {
+ * "$invalid" : true,
+ * "$expected" : <i>type-name</i>,
+ * "$value" : <i>invalid-value</i>,
+ * "$reason" : "<i>reason the item is invalid</i>"
+ * }
+ * </code>
+ *
+ * @tparam StringType The string type for \a type_name.
+ * @param json The JSON object to validate.
+ * @param type_name The type to validate \a json against.
+ * @param result A pointer to an item to receive the validated JSON object or
+ * null for none.
+ * @return Returns \c true only if \a json is valid.
+ */
+ template<class StringType>
+ typename std::enable_if<ZORBA_HAS_C_STR(StringType),bool>::type
+ validate( store::Item_t const &json, StringType const &type_name,
+ store::Item_t *result = nullptr ) const {
+ return validate( json, type_name.c_str(), result );
+ }
+
+private:
+ static_context const *sctx_;
+
+ // set of all imported namespaces
+ typedef std::unordered_set<zstring> namespace_set;
+ namespace_set namespaces_;
+
+ // map of all prefixes -> namespaces
+ typedef std::unordered_map<zstring,zstring> prefix_namespace_map;
+ prefix_namespace_map prefix_ns_;
+
+ // list of all types
+ typedef std::vector<type const*> type_list;
+ type_list types_;
+
+ // map of all fully-qualified type names (Q{uri}local) -> types
+ typedef std::unordered_map<zstring,type const*> name_type_map;
+ name_type_map name_type_;
+
+ // namespace of the loaded schema
+ zstring namespace_;
+
+ /**
+ * Finds or creates a new type.
+ *
+ * @param type_item If an xs:string, it's the name of the type to find;
+ * if an object, it's an inline type.
+ * @return Returns the existing or new type.
+ */
+ type const* find_or_create_type( store::Item_t const &type_item );
+
+ /**
+ * Attempts to find a type.
+ *
+ * @param type_name The type-name to find.
+ * @param not_found_error If \c true and the type is not found,
+ * throws an exception; otherwise returns \c null.
+ * @return Returns the type for \a type_name or \c null if not found
+ * (and \a not_found_error is \c false).
+ */
+ type const* find_type( zstring const &type_name,
+ bool not_found_error = true ) const;
+
+ /**
+ * Fully-qualify a type-name, then attempt to find the type.
+ *
+ * @param type_name A pointer to the type-name to fully qualify.
+ * @param not_found_error If \c true and the type is not found,
+ * throws an exception; otherwise returns \c null.
+ * @return Returns the type for \a type_name or \c null if not found
+ * (and \a not_found_error is \c false).
+ */
+ type const* fq_find_type( zstring *type_name,
+ bool not_found_error = true ) const;
+
+ /**
+ * Fully-qualify a type-name.
+ *
+ * @param type_name A pointer to the type-name to fully qualify.
+ * @param uri A pointer to receive the URI for the namespace, if any.
+ */
+ void fq_type_name( zstring *type_name, zstring *uri = nullptr ) const;
+
+ /**
+ * Import all of another schema's types into this schema.
+ *
+ * @param ns The namespace URI of the other schema.
+ * @param s A pointer to the schema to import from. It's types are moved,
+ * not copied; so when done, it will be empty.
+ */
+ void import( zstring const &ns, schema *s );
+
+ void load_import( store::Item_t const& );
+ void load_imports( store::Item_t const& );
+ void load_namespace( store::Item_t const& );
+ void load_top_type( store::Item_t const& );
+ type const* load_type( store::Item_t const& );
+ void load_types( store::Item_t const& );
+
+ /**
+ * Creates a new type.
+ *
+ * @param kind_item The item (that must be a string) containing the kind of
+ * item to create: "atomic", "array", "object", or "union".
+ * @return Returns the new type.
+ */
+ type* new_type( store::Item_t const &kind_item );
+
+ friend class array_type;
+ friend class atomic_type;
+ friend class object_type;
+ friend class type;
+ friend class union_type;
+
+ // Forbid these since we'd have to copy the entire type* tree and there's no
+ // need for this now.
+ schema( schema const& );
+ schema& operator=( schema const& );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // jsound
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */
=== added directory 'src/runtime/jsound/pregenerated'
=== added file 'src/runtime/jsound/pregenerated/jsound.cpp'
--- src/runtime/jsound/pregenerated/jsound.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/pregenerated/jsound.cpp 2013-12-06 05:12:46 +0000
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+#include "stdafx.h"
+#include "zorbatypes/rchandle.h"
+#include "zorbatypes/zstring.h"
+#include "runtime/visitors/planiter_visitor.h"
+#include "runtime/jsound/jsound.h"
+#include "system/globalenv.h"
+
+
+#include "store/api/iterator.h"
+
+namespace zorba {
+
+// <JSoundAnnotateIterator>
+SERIALIZABLE_CLASS_VERSIONS(JSoundAnnotateIterator)
+
+void JSoundAnnotateIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+ serialize_baseclass(ar,
+ (NaryBaseIterator<JSoundAnnotateIterator, PlanIteratorState>*)this);
+}
+
+
+void JSoundAnnotateIterator::accept(PlanIterVisitor& v) const
+{
+ v.beginVisit(*this);
+
+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+ for ( ; lIter != lEnd; ++lIter ){
+ (*lIter)->accept(v);
+ }
+
+ v.endVisit(*this);
+}
+
+JSoundAnnotateIterator::~JSoundAnnotateIterator() {}
+
+// </JSoundAnnotateIterator>
+
+
+// <JSoundValidateIterator>
+SERIALIZABLE_CLASS_VERSIONS(JSoundValidateIterator)
+
+void JSoundValidateIterator::serialize(::zorba::serialization::Archiver& ar)
+{
+ serialize_baseclass(ar,
+ (NaryBaseIterator<JSoundValidateIterator, PlanIteratorState>*)this);
+}
+
+
+void JSoundValidateIterator::accept(PlanIterVisitor& v) const
+{
+ v.beginVisit(*this);
+
+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+ for ( ; lIter != lEnd; ++lIter ){
+ (*lIter)->accept(v);
+ }
+
+ v.endVisit(*this);
+}
+
+JSoundValidateIterator::~JSoundValidateIterator() {}
+
+// </JSoundValidateIterator>
+
+
+
+}
+
+
=== added file 'src/runtime/jsound/pregenerated/jsound.h'
--- src/runtime/jsound/pregenerated/jsound.h 1970-01-01 00:00:00 +0000
+++ src/runtime/jsound/pregenerated/jsound.h 2013-12-06 05:12:46 +0000
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+#ifndef ZORBA_RUNTIME_JSOUND_JSOUND_H
+#define ZORBA_RUNTIME_JSOUND_JSOUND_H
+
+
+#include "common/shared_types.h"
+
+
+
+#include "runtime/base/narybase.h"
+
+
+namespace zorba {
+
+/**
+ *
+ * Author:
+ */
+class JSoundAnnotateIterator : public NaryBaseIterator<JSoundAnnotateIterator, PlanIteratorState>
+{
+public:
+ SERIALIZABLE_CLASS(JSoundAnnotateIterator);
+
+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSoundAnnotateIterator,
+ NaryBaseIterator<JSoundAnnotateIterator, PlanIteratorState>);
+
+ void serialize( ::zorba::serialization::Archiver& ar);
+
+ JSoundAnnotateIterator(
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& children)
+ :
+ NaryBaseIterator<JSoundAnnotateIterator, PlanIteratorState>(sctx, loc, children)
+ {}
+
+ virtual ~JSoundAnnotateIterator();
+
+ void accept(PlanIterVisitor& v) const;
+
+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+ *
+ * Author:
+ */
+class JSoundValidateIterator : public NaryBaseIterator<JSoundValidateIterator, PlanIteratorState>
+{
+public:
+ SERIALIZABLE_CLASS(JSoundValidateIterator);
+
+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSoundValidateIterator,
+ NaryBaseIterator<JSoundValidateIterator, PlanIteratorState>);
+
+ void serialize( ::zorba::serialization::Archiver& ar);
+
+ JSoundValidateIterator(
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& children)
+ :
+ NaryBaseIterator<JSoundValidateIterator, PlanIteratorState>(sctx, loc, children)
+ {}
+
+ virtual ~JSoundValidateIterator();
+
+ void accept(PlanIterVisitor& v) const;
+
+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+}
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
=== modified file 'src/runtime/nodes/nodes_impl.cpp'
--- src/runtime/nodes/nodes_impl.cpp 2013-07-24 08:12:12 +0000
+++ src/runtime/nodes/nodes_impl.cpp 2013-12-06 05:12:46 +0000
@@ -363,7 +363,7 @@
{
item_uri->getStringValue2( id );
// need to convert the opaque uri into a valid ncname
- if ( ascii::begins_with( id, "urn:uuid:" ) )
+ if ( ZA_BEGINS_WITH( id, "urn:uuid:" ) )
id.erase( 0, 9 );
ascii::remove_not_chars( id, ascii::alnum );
id.insert( (zstring::size_type)0, 1, 'u' );
=== modified file 'src/runtime/pregenerated/iterator_enum.h'
--- src/runtime/pregenerated/iterator_enum.h 2013-10-08 00:48:47 +0000
+++ src/runtime/pregenerated/iterator_enum.h 2013-12-06 05:12:46 +0000
@@ -164,6 +164,8 @@
TYPE_JSONRenameIterator,
TYPE_JSONArrayAppendIterator,
TYPE_JSONBoxIterator,
+ TYPE_JSoundAnnotateIterator,
+ TYPE_JSoundValidateIterator,
TYPE_SqrtIterator,
TYPE_ExpIterator,
TYPE_Exp10Iterator,
=== added directory 'src/runtime/spec/jsound'
=== added file 'src/runtime/spec/jsound/jsound.xml'
--- src/runtime/spec/jsound/jsound.xml 1970-01-01 00:00:00 +0000
+++ src/runtime/spec/jsound/jsound.xml 2013-12-06 05:12:46 +0000
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<zorba:iterators
+ xmlns:zorba="http://www.zorba-xquery.com"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
+
+<zorba:source>
+ <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
+</zorba:source>
+
+<!--========================================================================-->
+
+<zorba:iterator name="JSoundAnnotateIterator" arity="nary">
+ <zorba:function>
+ <zorba:signature localname="jsd-annotate" prefix="fn-zorba-jsound">
+ <zorba:param>object()</zorba:param>
+ <zorba:param>xs:string</zorba:param>
+ <zorba:param>item()</zorba:param>
+ <zorba:output>item()</zorba:output>
+ </zorba:signature>
+ </zorba:function>
+</zorba:iterator>
+
+<zorba:iterator name="JSoundValidateIterator" arity="nary">
+ <zorba:function>
+ <zorba:signature localname="jsd-validate" prefix="fn-zorba-jsound">
+ <zorba:param>object()</zorba:param>
+ <zorba:param>xs:string</zorba:param>
+ <zorba:param>item()</zorba:param>
+ <zorba:output>xs:boolean</zorba:output>
+ </zorba:signature>
+ </zorba:function>
+</zorba:iterator>
+
+<!--========================================================================-->
+
+</zorba:iterators>
+<!-- vim:set et sw=2 ts=2: -->
=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml 2013-10-17 02:01:22 +0000
+++ src/runtime/spec/mappings.xml 2013-12-06 05:12:46 +0000
@@ -122,6 +122,10 @@
define="ZORBA_JSON_XML_FN_NS"
prefix="fn-zorba-json"/>
+ <zorba:namespace uri="http://jsound.io/modules/jsound"
+ define="ZORBA_JSOUND_FN_NS"
+ prefix="fn-zorba-jsound"/>
+
<zorba:namespace uri="http://zorba.io/modules/fetch"
define="ZORBA_FETCH_FN_NS"
prefix="fn-zorba-fetch"/>
=== modified file 'src/runtime/update/update.cpp'
--- src/runtime/update/update.cpp 2013-09-17 21:12:49 +0000
+++ src/runtime/update/update.cpp 2013-12-06 05:12:46 +0000
@@ -584,7 +584,7 @@
else
{
if (lTargetKind == store::StoreConsts::commentNode &&
- (content.find("--") != zstring::npos || ascii::ends_with(content, "-", 1)))
+ (content.find("--") != zstring::npos || ZA_ENDS_WITH(content, "-")))
{
throw XQUERY_EXCEPTION(err::XQDY0072, ERROR_LOC(loc));
}
=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-10-08 00:48:47 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-12-06 05:12:46 +0000
@@ -334,6 +334,10 @@
class JSONBoxIterator;
+ class JSoundAnnotateIterator;
+
+ class JSoundValidateIterator;
+
class SqrtIterator;
class ExpIterator;
@@ -1219,6 +1223,12 @@
virtual void beginVisit ( const JSONBoxIterator& ) = 0;
virtual void endVisit ( const JSONBoxIterator& ) = 0;
+ virtual void beginVisit ( const JSoundAnnotateIterator& ) = 0;
+ virtual void endVisit ( const JSoundAnnotateIterator& ) = 0;
+
+ virtual void beginVisit ( const JSoundValidateIterator& ) = 0;
+ virtual void endVisit ( const JSoundValidateIterator& ) = 0;
+
virtual void beginVisit ( const SqrtIterator& ) = 0;
virtual void endVisit ( const SqrtIterator& ) = 0;
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-10-08 00:48:47 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-12-06 05:12:46 +0000
@@ -56,6 +56,7 @@
#include "runtime/item/item.h"
#include "runtime/json/json.h"
#include "runtime/json/jsoniq_functions.h"
+#include "runtime/jsound/jsound.h"
#include "runtime/maths/maths.h"
#include "runtime/nodes/node_position.h"
#include "runtime/nodes/nodes.h"
@@ -2012,6 +2013,34 @@
// </JSONBoxIterator>
+// <JSoundAnnotateIterator>
+void PrinterVisitor::beginVisit ( const JSoundAnnotateIterator& a) {
+ thePrinter.startBeginVisit("JSoundAnnotateIterator", ++theId);
+ printCommons( &a, theId );
+ thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const JSoundAnnotateIterator& ) {
+ thePrinter.startEndVisit();
+ thePrinter.endEndVisit();
+}
+// </JSoundAnnotateIterator>
+
+
+// <JSoundValidateIterator>
+void PrinterVisitor::beginVisit ( const JSoundValidateIterator& a) {
+ thePrinter.startBeginVisit("JSoundValidateIterator", ++theId);
+ printCommons( &a, theId );
+ thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const JSoundValidateIterator& ) {
+ thePrinter.startEndVisit();
+ thePrinter.endEndVisit();
+}
+// </JSoundValidateIterator>
+
+
// <SqrtIterator>
void PrinterVisitor::beginVisit ( const SqrtIterator& a) {
thePrinter.startBeginVisit("SqrtIterator", ++theId);
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-10-08 00:48:47 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-12-06 05:12:46 +0000
@@ -511,6 +511,12 @@
void beginVisit( const JSONBoxIterator& );
void endVisit ( const JSONBoxIterator& );
+ void beginVisit( const JSoundAnnotateIterator& );
+ void endVisit ( const JSoundAnnotateIterator& );
+
+ void beginVisit( const JSoundValidateIterator& );
+ void endVisit ( const JSoundValidateIterator& );
+
void beginVisit( const SqrtIterator& );
void endVisit ( const SqrtIterator& );
=== modified file 'src/util/ascii_util.h'
--- src/util/ascii_util.h 2013-08-26 22:29:11 +0000
+++ src/util/ascii_util.h 2013-12-06 05:12:46 +0000
@@ -351,6 +351,13 @@
}
/**
+ * A macro for calling ascii::begins_with() with a second argument of a string
+ * literal.
+ */
+#define ZA_BEGINS_WITH(STRING,LITERAL) \
+ ::zorba::ascii::begins_with( STRING, LITERAL, sizeof( LITERAL ) - 1 )
+
+/**
* Checks whether a string ends with a given suffix.
*
* @param s The string to check.
@@ -448,6 +455,13 @@
return ends_with( s, ss.data(), ss.size() );
}
+/**
+ * A macro for calling ascii::ends_with() with a second argument of a string
+ * literal.
+ */
+#define ZA_ENDS_WITH(STRING,LITERAL) \
+ ::zorba::ascii::ends_with( STRING, LITERAL, sizeof( LITERAL ) - 1 )
+
////////// Case conversion ////////////////////////////////////////////////////
/**
=== modified file 'src/util/fs_util.cpp'
--- src/util/fs_util.cpp 2013-08-05 22:12:13 +0000
+++ src/util/fs_util.cpp 2013-12-06 05:12:46 +0000
@@ -143,7 +143,7 @@
}
static bool parse_file_uri( char const *uri, string *result ) {
- if ( !ascii::begins_with( uri, "file://" ) )
+ if ( !ZA_BEGINS_WITH( uri, "file://" ) )
return false;
using namespace diagnostic;
=== modified file 'src/util/string_util.h'
--- src/util/string_util.h 2013-06-17 19:10:40 +0000
+++ src/util/string_util.h 2013-12-06 05:12:46 +0000
@@ -204,7 +204,7 @@
* A macro for calling equals() with a second argument of a string literal.
*/
#define ZSTREQ(STRING,LITERAL) \
- ::zorba::ztd::equals( STRING, LITERAL, sizeof( LITERAL ) - 1 )
+ ::zorba::ztd::equals( STRING, LITERAL, sizeof( LITERAL ) - 1 )
////////// String splitting ////////////////////////////////////////////////////
=== modified file 'src/zorbamisc/ns_consts.h'
--- src/zorbamisc/ns_consts.h 2013-08-09 08:27:30 +0000
+++ src/zorbamisc/ns_consts.h 2013-12-06 05:12:46 +0000
@@ -36,7 +36,12 @@
#define XSI_NS W3C_NS "2001/XMLSchema-instance"
-#define JSONIQ_ERR_NS "http://jsoniq.org/errors"
+#define JSONIQ_NS_BASE "http://jsoniq.org/"
+#define JSONIQ_ERR_NS JSONIQ_NS_BASE "errors"
+
+#define JSOUND_NS_BASE "http://jsound.org/"
+#define JSOUND_SCHEMA_NS JSOUND_NS_BASE "schema"
+#define JSOUND_ERR_NS JSOUND_SCHEMA_NS
///////////////////////////////////////////////////////////////////////////////
=== modified file 'src/zorbatypes/URI.cpp'
--- src/zorbatypes/URI.cpp 2013-10-11 18:04:57 +0000
+++ src/zorbatypes/URI.cpp 2013-12-06 05:12:46 +0000
@@ -1414,7 +1414,7 @@
// 6d If the buffer string ends with "." as a complete path segment,
// that "." is removed.
- if (ascii::ends_with(path, "/.", 2))
+ if (ZA_ENDS_WITH(path, "/."))
{
path = path.substr(0, path.size() - 1);
}
@@ -1470,7 +1470,7 @@
// 6f) If the buffer string ends with "<segment>/..", where <segment>
// is a complete path segment not equal to "..", that
// "<segment>/.." is removed.
- if (ascii::ends_with(path, "/..", 3))
+ if (ZA_ENDS_WITH(path, "/.."))
{
// Find start of <segment> within substring ending at found point.
lIndex = path.size() - 3;
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-anonymous-type-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-anonymous-type-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-anonymous-type-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,13 @@
+{
+ "k1" : {
+ "$invalid" : true,
+ "$expected" : {
+ "$name" : "<anonymous>",
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ },
+ "$value" : 6,
+ "$reason" : "value violates $maxInclusive facet of type"
+ }
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}foo",
+ "$value" : "bar",
+ "$reason" : "\"xs:string\": invalid value type; must be array"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+[ {
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}tiny-integer",
+ "$value" : 6,
+ "$reason" : "value violates $maxInclusive facet of type Q{http://www.example.com/my-schema}tiny-integer"
+} ]
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-array-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+[ 2, 4, {
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}foo",
+ "$value" : 6,
+ "$reason" : "value violates $maxInclusive facet of type Q{http://www.example.com/my-schema}foo"
+}, 4, 2 ]
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-atomic-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-atomic-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-atomic-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}foo",
+ "$value" : "bar",
+ "$reason" : "\"xs:string\": invalid value type; must be xs:integer"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}even",
+ "$value" : 41,
+ "$reason" : "value violates $constraints facet \"$$ mod 2 eq 0\" of type Q{http://www.example.com/my-schema}even"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}even",
+ "$value" : 42,
+ "$reason" : "value violates $constraints facet \"$$ ne 42\" of type Q{http://www.example.com/my-schema}even"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}not-42",
+ "$value" : 41,
+ "$reason" : "value violates $constraints facet \"$$ mod 2 eq 0\" of type Q{http://www.example.com/my-schema}even"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-constraints-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,8 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}foo",
+ "$value" : {
+ "k1" : 41
+ },
+ "$reason" : "value violates $constraints facet \"$$ mod 2 eq 0\" of type Q{http://www.example.com/my-schema}foo: [jerr:JNTY0004]: can not atomize an object item: an object has probably been passed where an atomic value is expected (e.g., as a key, or to a function expecting an atomic item)"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,5 @@
+{
+ "start" : [ 1, 2 ],
+ "end" : [ 3, 4 ],
+ "lineWidth" : 1
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-default-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,3 @@
+{
+ "foo" : 2
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}tiny-even",
+ "$value" : 6,
+ "$reason" : "value violates $maxInclusive facet of type Q{http://www.example.com/tiny-int}tiny-int"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-imports-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}tiny-even",
+ "$value" : 3,
+ "$reason" : "value violates $constraints facet \"$$ mod 2 eq 0\" of type Q{http://www.example.com/my-schema}tiny-even"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+5
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-minInclusive-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}foo",
+ "$value" : 4,
+ "$reason" : "value violates $minInclusive facet of type Q{http://www.example.com/my-schema}foo"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-object-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-object-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-object-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,10 @@
+{
+ "start" : [ 1, 2 ],
+ "end" : [ 3, 4 ],
+ "lineWidth" : {
+ "$invalid" : true,
+ "$expected" : "Q{http://zorba.io/modules/images/}lineWidth",
+ "$value" : 0,
+ "$reason" : "value violates $minExclusive facet of type Q{http://zorba.io/modules/images/}lineWidth"
+ }
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-union-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-union-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-annotate-union-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,6 @@
+{
+ "$invalid" : true,
+ "$expected" : "Q{http://www.example.com/my-schema}integer-or-string",
+ "$value" : false,
+ "$reason" : "\"xs:boolean\": invalid value type; must be a union member type"
+}
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-err-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-err-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-array-err-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== renamed file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-integer.xml.res' => 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-01.xml.res'
=== removed file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-array.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-array.xml.res 2013-10-02 22:40:32 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-array.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-true
=== renamed file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-string.xml.res' => 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-string-01.xml.res'
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-string-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-string-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-string-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== renamed file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-atomic-str-enum.xml.res' => 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-enum-string-01.xml.res'
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-05.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-06.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-06.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-explicitTimezone-06.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-fractionDigits-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-imports-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-imports-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-imports-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-length-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxExclusive-05.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxInclusive-05.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-maxLength-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-05.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-06.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-06.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-06.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-07.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-07.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minExclusive-07.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-04.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minInclusive-05.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-minLength-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== renamed file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-object1.xml.res' => 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-object-01.xml.res'
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-pattern-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-totalDigits-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-02.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-02.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-03.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+true
=== added file 'test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-err-01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-err-01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsound/jsound-union-err-01.xml.res 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+false
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-about-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-about-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-about-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$about" : 42, (: must be string :)
+ "$kind" : "atomic",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-about-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-about-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-about-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,28 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "k1" : {
+ "$type" :
+ {
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ }
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := { "k1" : 6 (: must be <= 5 :) }
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-anonymous-type-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "integer" ]
+ }
+ ]
+ }
+
+let $instance := "bar" (: must be array :)
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "tiny-integer",
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ },
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "tiny-integer" ]
+ }
+ ]
+ }
+
+let $instance := [ 6 ] (: must be <= 5 :)
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ },
+ {
+ "$kind" : "array",
+ "$name" : "bar",
+ "$content" : [ "foo" ]
+ }
+ ]
+ }
+
+let $instance := [ 2, 4, 6 (: must be <= 5 :), 4, 2 ]
+
+return jsd:jsd-annotate( $jsd, "bar", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-array-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := "bar"
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-atomic-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "even",
+ "$baseType" : "integer",
+ "$constraints" : [ "$$ mod 2 eq 0" ]
+ }
+ ]
+ }
+
+let $instance := 41 (: must be even :)
+
+return jsd:jsd-annotate( $jsd, "even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,23 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "even",
+ "$baseType" : "integer",
+ "$constraints" : [
+ "$$ mod 2 eq 0",
+ "$$ ne 42"
+ ]
+ }
+ ]
+ }
+
+let $instance := 42 (: must not be 42 :)
+
+return jsd:jsd-annotate( $jsd, "even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "even",
+ "$baseType" : "integer",
+ "$constraints" : [ "$$ mod 2 eq 0" ]
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "not-42",
+ "$baseType" : "even",
+ "$constraints" : [ "$$ ne 42" ]
+ }
+ ]
+ }
+
+let $instance := 41 (: must be even :)
+
+return jsd:jsd-annotate( $jsd, "not-42", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "object",
+ "$name" : "foo",
+ "$content" : {
+ "k1" : {
+ "$type" : "integer"
+ }
+ },
+ "$constraints" : [ "$$ mod 2 eq 0" ] (: $$ can not be object :)
+ }
+ ]
+ }
+
+let $instance := { "k1" : 41 }
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-constraints-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,41 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://zorba.io/modules/images/",
+ "$types" : [
+ {
+ "$name" : "pointType",
+ "$kind" : "array",
+ "$content" : [ "integer" ],
+ "$minLength" : 2,
+ "$maxLength" : 2
+ },
+ {
+ "$name" : "line",
+ "$kind" : "object",
+ "$content" : {
+ "start" : {
+ "$type" : "pointType"
+ },
+ "end" : {
+ "$type" : "pointType"
+ },
+ "lineWidth" : {
+ "$type" : "integer",
+ "$default" : 1
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "start" : [ 1, 2 ],
+ "end" : [ 3, 4 ]
+ }
+
+return jsd:jsd-annotate( $jsd, "line", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-default-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,35 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://zorba.io/modules/images/",
+ "$types" : [
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer",
+ "$default" : 1
+ }
+ }
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer",
+ "$default" : 2
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := { } (: { "foo" : 2 } should be added :)
+
+return jsd:jsd-annotate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-default-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,32 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+declare variable $rbktPath as xs:string external;
+
+let $location :=
+ concat( $rbktPath, "/Queries/zorba/jsound/schemas/tiny-int.jsd" )
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/tiny-int",
+ "$prefix" : "tint",
+ "$location" : $location
+ }
+ ],
+ "$types" : [
+ {
+ "$name" : "tiny-even",
+ "$kind" : "atomic",
+ "$baseType" : "tint:tiny-int",
+ "$constraints" : [ "$$ mod 2 eq 0" ]
+ }
+ ]
+ }
+
+let $instance := 6 (: must be <= 5 :)
+
+return jsd:jsd-annotate( $jsd, "tiny-even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,4 @@
+Serialization: indent=yes
+Args:
+-x
+rbktPath:=xs:string($RBKT_SRC_DIR)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,32 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+declare variable $rbktPath as xs:string external;
+
+let $location :=
+ concat( $rbktPath, "/Queries/zorba/jsound/schemas/tiny-int.jsd" )
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/tiny-int",
+ "$prefix" : "tint",
+ "$location" : $location
+ }
+ ],
+ "$types" : [
+ {
+ "$name" : "tiny-even",
+ "$kind" : "atomic",
+ "$baseType" : "tint:tiny-int",
+ "$constraints" : [ "$$ mod 2 eq 0" ]
+ }
+ ]
+ }
+
+let $instance := 3 (: must be even :)
+
+return jsd:jsd-annotate( $jsd, "tiny-even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-imports-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,4 @@
+Serialization: indent=yes
+Args:
+-x
+rbktPath:=xs:string($RBKT_SRC_DIR)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 4 (: must be >= 5 :)
+
+return jsd:jsd-annotate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-minInclusive-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,48 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://zorba.io/modules/images/",
+ "$types" : [
+ {
+ "$name" : "pointType",
+ "$kind" : "array",
+ "$content" : [ "integer" ],
+ "$minLength" : 2,
+ "$maxLength" : 2
+ },
+ {
+ "$name" : "lineWidth",
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$minExclusive" : 0
+ },
+ {
+ "$name" : "line",
+ "$kind" : "object",
+ "$content" : {
+ "start" : {
+ "$type" : "pointType"
+ },
+ "end" : {
+ "$type" : "pointType"
+ },
+ "lineWidth" : {
+ "$type" : "lineWidth",
+ "$default" : 1
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "start" : [ 1, 2 ],
+ "end" : [ 3, 4 ],
+ "lineWidth" : 0 (: must be > 0 :)
+ }
+
+return jsd:jsd-annotate( $jsd, "line", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-object-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "integer-or-string",
+ "$kind" : "union",
+ "$content" : [ "integer", "string" ]
+ }
+ ]
+ }
+
+let $instance := false (: must be integer or string :)
+
+return jsd:jsd-annotate( $jsd, "integer-or-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-annotate-union-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Serialization: indent=yes
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-array-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-array-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-array-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ },
+ {
+ "$kind" : "array",
+ "$name" : "bar",
+ "$content" : [ "foo" ]
+ }
+ ]
+ }
+
+let $instance := [ 1, 2, 3, 4, 5, 6 (: must be <= 5 :) ]
+
+return jsd:jsd-validate( $jsd, "bar", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-array-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-array-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-array-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ },
+ {
+ "$kind" : "array",
+ "$name" : "bar",
+ "$content" : [ "foo" ]
+ }
+ ]
+ }
+
+let $instance := [ 1, 2, 3, 4, 5 ]
+
+return jsd:jsd-validate( $jsd, "bar", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-array-err.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-array-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-array-err.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-array-03.jq 2013-12-06 05:12:46 +0000
@@ -1,19 +1,19 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "array",
- "$name" : "a-string-array",
- "$content" : [ "string" ]
- }
- ]
-}
-
-
-let $instance := ["", "a", "abc", 123]
-
-return
- jsv:jsd-valid($jsd, "a-string-array", "http://www.example.com/my-schema", $instance)
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "a-string-array",
+ "$content" : [ "string" ]
+ }
+ ]
+ }
+
+let $instance := [ "", "a", "abc", 123 (: must be string :) ]
+
+return jsd:jsd-validate( $jsd, "a-string-array", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-array-length-err.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-array-length-err.spec 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-array-length-err.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: jsv:Invalid : Invalid array size, bigger than $maxLength facet constraint.
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-array-length-err.xq'
--- test/rbkt/Queries/zorba/jsound/jsound-array-length-err.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-array-length-err.xq 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
-
-let $jsd :=
-{
- "$namespace" : "http://zorba.io/modules/images/",
- "$types" : [
- {
- "$name" : "pointType",
- "$kind" : "array",
- "$content" : [ "integer" ],
- "$minLength" : 2,
- "$maxLength" : 2
- },
- {
- "$name" : "line",
- "$kind" : "object",
- "$content" :
- {
- "start" :
- {
- "$type" : "pointType"
- },
- "end" :
- {
- "$type" : "integer"
- },
- "strokeWidth" :
- {
- "$type" : "double",
- "$optional" : true
- },
- "antiAliasing" :
- {
- "$type" : "boolean",
- "$optional" : true
- }
- }
- }
- ]
-}
-
-
-
-let $instance :=
- {
- "start": [1, 2, 5],
- "end": 5
- }
-
-return
- jsv:jsd-valid($jsd, "line", "http://zorba.io/modules/images/", $instance)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-integer.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-atomic-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-integer.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-01.jq 2013-12-06 05:12:46 +0000
@@ -1,19 +1,19 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "atomic",
- "$name" : "small-number",
- "$baseType" : "integer"
- }
- ]
-}
-
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "small-number",
+ "$baseType" : "integer"
+ }
+ ]
+ }
let $instance := 5
-return
- jsv:jsd-valid($jsd, "small-number", "http://www.example.com/my-schema", $instance)
+return jsd:jsd-validate( $jsd, "small-number", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-array-err.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-array-err.spec 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-array-err.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: jsv:Invalid : Expected string value.
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-array.xq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-array.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-array.xq 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
-
-let $instance := ["", "a", "abc"]
-
-return
- jsv:jsd-valid("http://zorba-tests.28msec.us/jsound-schema",
- "a-string-array", $instance)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-string.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-atomic-string-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-string.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-string-01.jq 2013-12-06 05:12:46 +0000
@@ -1,19 +1,19 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "atomic",
- "$name" : "a-string",
- "$baseType" : "string"
- }
- ]
-}
-
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "a-string",
+ "$baseType" : "string"
+ }
+ ]
+ }
let $instance := "hello"
-return
- jsv:jsd-valid($jsd, "a-string", "http://www.example.com/my-schema", $instance)
+return jsd:jsd-validate( $jsd, "a-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-string-err1.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-atomic-string-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-string-err1.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-string-02.jq 2013-12-06 05:12:46 +0000
@@ -1,19 +1,19 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "atomic",
- "$name" : "a-string",
- "$baseType" : "string"
- }
- ]
-}
-
-
-let $instance := 1
-
-return
- jsv:jsd-valid($jsd, "a-string", "http://www.example.com/my-schema", $instance)
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "a-string",
+ "$baseType" : "string"
+ }
+ ]
+ }
+
+let $instance := 42 (: must be string :)
+
+return jsd:jsd-validate( $jsd, "a-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-string-err1.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-string-err1.spec 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-atomic-string-err1.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: jsv:Invalid : Expected string value
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "missing" (: unknown type :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:UNKNOWN_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "pfx:missing" (: unknown prefix :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:UNKNOWN_PREFIX
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : 42 (: illegal type :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "base"
+ (: "$baseType" missing :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "base",
+ "$baseType" : "integer"
+ },
+ {
+ "$kind" : "object",
+ "$name" : "derived",
+ "$baseType" : "base" (: must be object :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-baseType-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$constraints" : true (: must be array of string :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$constraints" : [ true ] (: must be array of string :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "even",
+ "$baseType" : "integer",
+ "$constraints" : [ "$$ modulus 2 eq 0" ] (: "modulus" is invalid :)
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-constraints-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object"
+ (: "$content" is missing :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : "integer" (: must be object :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "array",
+ "$content" : "integer" (: must be singleton array :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "array",
+ "$content" : [ "string", "integer" ] (: must be singleton array :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-content-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-content-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-content-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_ARRAY_SIZE
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum-err.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum-err.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-01.jq 2013-12-06 05:12:46 +0000
@@ -1,20 +1,20 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "atomic",
- "$name" : "a-string-enum",
- "$baseType" : "string",
- "$enumeration" : [ "foo", "bar"]
- }
- ]
-}
-
-
-let $instance := "baz-not-valid"
-
-return
- jsv:jsd-valid($jsd, "a-string-enum", "http://www.example.com/my-schema", $instance)
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$enumeration" : true (: must be array :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum-err.spec' => 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum-err.spec 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-01.spec 2013-12-06 05:12:46 +0000
@@ -1,1 +1,1 @@
-Error: jsv:Invalid : Instance value not in the enumeration list.
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$enumeration" : "foo" (: must be array :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$enumeration" : [ "foo", 42 ] (: must be array of string :)
+ }
+ ]
+ }
+
+let $instance := "baz"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:TYPE_MISMATCH
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$enumeration" : [ 1, 2, 3 ]
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$enumeration" : [ 1, 2, 3, 4 ]
+ }
+ ]
+ }
+
+let $instance := 4
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-enum-string-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-atomic-str-enum.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-enum-string-01.jq 2013-12-06 05:12:46 +0000
@@ -1,20 +1,20 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://www.example.com/my-schema",
- "$types" : [
- {
- "$kind" : "atomic",
- "$name" : "a-string-enum",
- "$baseType" : "string",
- "$enumeration" : [ "foo", "bar"]
- }
- ]
-}
-
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$enumeration" : [ "foo", "bar" ]
+ }
+ ]
+ }
let $instance := "bar"
-return
- jsv:jsd-valid($jsd, "a-string-enum", "http://www.example.com/my-schema", $instance)
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "required"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "required"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00-08:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "prohibited"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00-08:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "prohibited"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "optional"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "optional"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00-08:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : true
+ (: must be one of "prohobited", "optional", or "required" :)
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "true"
+ (: must be one of "prohobited", "optional", or "required" :)
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "prohibited"
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$explicitTimezone" : "optional"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "prohibited"
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$explicitTimezone" : "required"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "required"
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$explicitTimezone" : "optional"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "time",
+ "$explicitTimezone" : "required"
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$explicitTimezone" : "prohibited"
+ }
+ ]
+ }
+
+let $instance := xs:time( "11:42:00" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-explicitTimezone-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "string",
+ "$default" : 42 (: must be string :)
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-default-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:TYPE_MISMATCH
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "string",
+ "$optional" : "true" (: must be boolean :)
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-optional-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ (: "$type" missing :)
+ "$optional" : true
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,58 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "obj-a",
+ "$kind" : "object",
+ "$content" : {
+ "f1" : {
+ "$type" : "string"
+ }
+ }
+ },
+ {
+ "$name" : "obj-b",
+ "$kind" : "object",
+ "$content" : {
+ "f1" : {
+ "$type" : "integer"
+ }
+ }
+ },
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "obj-a"
+ }
+ }
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ (:
+ : "base" can not be a base type of "derived" because:
+ : + the type of derived's "foo" (obj-b) is not a subtype of the type
+ : of base's "foo" (obj-a) because:
+ : + the type of obj-b's "f1" (integer) is not a subtype of the type
+ : of obj-a's "f1" (string)
+ :)
+ "$content" : {
+ "foo" : {
+ "$type" : "obj-b"
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := "doesn't matter"
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,75 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ (:
+ : Test the subtype assertion where one type (type-1) has a key ("foo")
+ : inherited from its base type (base-1) and the other type (type-2) has
+ : the same key ("foo") directly.
+ :)
+ {
+ "$name" : "base-1",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "float"
+ }
+ }
+ },
+ {
+ "$name" : "type-1",
+ "$kind" : "object",
+ "$baseType" : "base-1",
+ "$content" : {
+ "bar" : {
+ "$type" : "boolean"
+ }
+ }
+ },
+ {
+ "$name" : "type-2",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "string"
+ }
+ }
+ },
+
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "f1" : {
+ "$type" : "type-1"
+ }
+ }
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ (:
+ : "base" can not be a base type of "derived" because:
+ : + the type of derived's "f1" (type-2) is not a subtype of the type
+ : of base's "f1" (type-1) because:
+ : + the type of type-2's "foo" (string) is not a subtype of the type
+ : of type-1's "foo" (float)
+ :)
+ "$content" : {
+ "f1" : {
+ "$type" : "type-2"
+ }
+ }
+ }
+
+ ]
+ }
+
+let $instance := "doesn't matter"
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,75 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ (:
+ : Test the subtype assertion where one type (type-1) has a key ("foo")
+ : inherited from its base type (base-1) and the other type (type-2) has
+ : the same key ("foo") directly.
+ :)
+ {
+ "$name" : "base-1",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "float"
+ }
+ }
+ },
+ {
+ "$name" : "type-1",
+ "$kind" : "object",
+ "$baseType" : "base-1",
+ "$content" : {
+ "bar" : {
+ "$type" : "boolean"
+ }
+ }
+ },
+ {
+ "$name" : "type-2",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "string"
+ }
+ }
+ },
+
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "f1" : {
+ "$type" : "type-2"
+ }
+ }
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ (:
+ : "base" can not be a base type of "derived" because:
+ : + the type of derived's "f1" (type-1) is not a subtype of the type
+ : of base's "f1" (type-2) because:
+ : + the type of type-1's "foo" (string) is not a subtype of the type
+ : of type-2's "foo" (float)
+ :)
+ "$content" : {
+ "f1" : {
+ "$type" : "type-1"
+ }
+ }
+ }
+
+ ]
+ }
+
+let $instance := "doesn't matter"
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fd-type-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : 2
+ }
+ ]
+ }
+
+let $instance := 98.6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : 1
+ }
+ ]
+ }
+
+let $instance := 98.6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$fractionDigits" : 5 (: illegal facet for integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : -1 (: must be >= 0 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : 2
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$fractionDigits" : 3 (: must be <= 2 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$fractionDigits" : 6,
+ "$totalDigits" : 5 (: must be >= 6 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-fractionDigits-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,32 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+declare variable $rbktPath as xs:string external;
+
+let $location :=
+ concat( $rbktPath, "/Queries/zorba/jsound/schemas/tiny-int.jsd" )
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/tiny-int",
+ "$prefix" : "tint",
+ "$location" : $location
+ }
+ ],
+ "$types" : [
+ {
+ "$name" : "tiny-even",
+ "$kind" : "atomic",
+ "$baseType" : "tint:tiny-int",
+ "$constraints" : [ "$$ mod 2 eq 0" ]
+ }
+ ]
+ }
+
+let $instance := 2
+
+return jsd:jsd-validate( $jsd, "tiny-even", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,4 @@
+Serialization: indent=yes
+Args:
+-x
+rbktPath:=xs:string($RBKT_SRC_DIR)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : true,
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [ true ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ (: "$namespace" missing :)
+ "$prefix" : "other"
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : true, (: must be string :)
+ "$prefix" : "other"
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/my-other-schema"
+ (: "$prefix" missing :)
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,25 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/my-other-schema",
+ "$prefix" : true (: must be string :)
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/my-other-schema",
+ "$prefix" : "other",
+ "$location" : true (: must be string :)
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-07.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$imports" : [
+ {
+ "$namespace" : "http://www.example.com/my-other-schema",
+ "$prefix" : "other",
+ "$foo" : true (: invalid key :)
+ }
+ ],
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer"
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-imports-err-08.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_KEY
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.spec 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://jsoniq.org/errors:JNDY0021
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.xq'
--- test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-invalid-schema.xq 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
-
-let $instance := ["", "a", "abc"]
-
-return
- jsv:jsd-valid("http://zorba-tests.28msec.us/invalid-jsound-schema",
- "a-string-array", $instance)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,18 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : 42, (: must be string :)
+ "$name" : "foo"
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-kind-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$length" : 5
+ }
+ ]
+ }
+
+let $instance := "abcd" (: not required length of 5 :)
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$length" : 5
+ }
+ ]
+ }
+
+let $instance := "abcde"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$length" : 5 (: illegal facet for integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$length" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$length" : -1 (: must be >= 0 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$length" : 5
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$length" : 6 (: must be <= foo's length :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-length-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-length-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-length-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 4
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 10,
+ "$maxExclusive" : 11 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$minExclusive" : 10,
+ "$maxExclusive" : 11 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10.5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 10,
+ "$maxExclusive" : 11 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$maxExclusive" : 5 (: illegal facet for string :)
+ }
+ ]
+ }
+
+let $instance := "bar"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 42
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$maxExclusive" : 43 (: must be <= 42 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 10,
+ "$maxExclusive" : 10 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 10,
+ "$maxExclusive" : 10 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 10,
+ "$maxExclusive" : 10 (: must be > 10 :)
+ }
+ ]
+ }
+
+let $instance := 10
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxExclusive-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5,
+ "$maxInclusive" : 4 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5,
+ "$maxInclusive" : 6 (: must be > 5 :)
+ }
+ ]
+ }
+
+let $instance := 6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5,
+ "$maxInclusive" : 5 (: must be >= 5 :)
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$maxInclusive" : 5 (: illegal facet for string :)
+ }
+ ]
+ }
+
+let $instance := "bar"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 42
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$maxInclusive" : 43 (: must be <= 42 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5,
+ "$maxInclusive" : 5 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5,
+ "$maxInclusive" : 5 (: must be > 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5,
+ "$maxInclusive" : 4 (: must be >= 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxInclusive-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "integer" ],
+ "$maxLength" : 2
+ }
+ ]
+ }
+
+let $instance := [ 1, 2, 3 ]
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "integer" ],
+ "$maxLength" : 2
+ }
+ ]
+ }
+
+let $instance := [ 1, 2 ]
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$maxLength" : true (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$maxLength" : -1 (: must be >= 0 :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "base",
+ "$kind" : "array",
+ "$content" : [ "string" ],
+ "$maxLength" : 2
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "array",
+ "$baseType" : "base",
+ "$maxLength" : 3 (: must be <= 2 :)
+ }
+ ]
+ }
+
+let $instance := [ "foo" ]
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-maxLength-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "date",
+ "$minExclusive" : xs:date( "2013-11-23" )
+ }
+ ]
+ }
+
+let $instance := xs:date( "2013-11-23" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "date",
+ "$minExclusive" : xs:date( "2013-11-23" )
+ }
+ ]
+ }
+
+let $instance := xs:date( "2013-11-24" )
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$maxExclusive" : 5,
+ "$minExclusive" : 4 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 4.5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5,
+ "$minExclusive" : 4 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-07.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-07.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-07.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5,
+ "$minExclusive" : 4 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$minExclusive" : 5 (: illegal facet for string :)
+ }
+ ]
+ }
+
+let $instance := "bar"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 42
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$minExclusive" : 41 (: must be >= 42 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5,
+ "$minExclusive" : 5 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5,
+ "$minExclusive" : 5 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5,
+ "$minExclusive" : 5 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minExclusive-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 4
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5,
+ "$minInclusive" : 4
+ }
+ ]
+ }
+
+let $instance := 4
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5,
+ "$minInclusive" : 5
+ }
+ ]
+ }
+
+let $instance := 5
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5,
+ "$minInclusive" : 6
+ }
+ ]
+ }
+
+let $instance := 6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$minInclusive" : 5 (: illegal facet for string :)
+ }
+ ]
+ }
+
+let $instance := "bar"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : "bar" (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minInclusive" : 42
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$minInclusive" : 41 (: must be >= 42 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxExclusive" : 5,
+ "$minInclusive" : 5 (: must be < 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5,
+ "$minInclusive" : 6 (: must be <= 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "integer",
+ "$minExclusive" : 5,
+ "$minInclusive" : 5 (: must be > 5 :)
+ }
+ ]
+ }
+
+let $instance := 1
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minInclusive-err-06.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "integer" ],
+ "$minLength" : 2
+ }
+ ]
+ }
+
+let $instance := [ 1 ]
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "array",
+ "$name" : "foo",
+ "$content" : [ "integer" ],
+ "$minLength" : 2
+ }
+ ]
+ }
+
+let $instance := [ 1, 2 ]
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$minLength" : true (: must be integer :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$minLength" : -1 (: must be >= 0 :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-minLength-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-missing-schema.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-missing-schema.spec 2013-10-16 22:17:33 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-missing-schema.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://zorba.io/modules/uri:URI_UNRESOLVED_OR_NOSTREAM
\ No newline at end of file
=== removed file 'test/rbkt/Queries/zorba/jsound/jsound-missing-schema.xq'
--- test/rbkt/Queries/zorba/jsound/jsound-missing-schema.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-missing-schema.xq 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
-
-let $instance := ["", "a", "abc"]
-
-return
- jsv:jsd-valid("http://zorba-tests.28msec.us/unknown-schema",
- "a-string-array", $instance)
=== renamed file 'test/rbkt/Queries/zorba/jsound/jsound-object1.xq' => 'test/rbkt/Queries/zorba/jsound/jsound-object-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-object1.xq 2013-10-02 22:40:32 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-01.jq 2013-12-06 05:12:46 +0000
@@ -1,51 +1,37 @@
-import module namespace jsv = "http://jsound.io/modules/validate";
+import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
-{
- "$namespace" : "http://zorba.io/modules/images/",
- "$types" : [
- {
- "$name" : "pointType",
- "$kind" : "array",
- "$content" : [ "integer" ],
- "$minLength" : 2,
- "$maxLength" : 2
- },
- {
- "$name" : "line",
- "$kind" : "object",
- "$content" :
- {
- "start" :
- {
- "$type" : "pointType"
- },
- "end" :
- {
- "$type" : "integer"
- },
- "strokeWidth" :
- {
- "$type" : "double",
- "$optional" : true
- },
- "antiAliasing" :
- {
- "$type" : "boolean",
- "$optional" : true
- }
- }
- }
- ]
-}
-
-
+ {
+ "$namespace" : "http://zorba.io/modules/images/",
+ "$types" : [
+ {
+ "$name" : "pointType",
+ "$kind" : "array",
+ "$content" : [ "integer" ],
+ "$minLength" : 2,
+ "$maxLength" : 2
+ },
+ {
+ "$name" : "line",
+ "$kind" : "object",
+ "$content" : {
+ "start" : {
+ "$type" : "pointType"
+ },
+ "end" : {
+ "$type" : "pointType"
+ }
+ }
+ }
+ ]
+ }
let $instance :=
{
- "start": [1, 2],
- "end": 5
+ "start" : [ 1, 2 ],
+ "end" : [ 3, 4 ]
}
-return
- jsv:jsd-valid($jsd, "line", "http://zorba.io/modules/images/", $instance)
+return jsd:jsd-validate( $jsd, "line", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,37 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema/",
+ "$types" : [
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer"
+ }
+ },
+ "$open" : false
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ "$content" : {
+ "bar" : { (: new key not allowed when base.$open = false :)
+ "$type" : "integer"
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "foo" : 42
+ }
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:NEW_KEY_NOT_ALLOWED
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,37 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema/",
+ "$types" : [
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "decimal"
+ }
+ },
+ "$open" : false
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ "$content" : {
+ "foo" : { (: foo's type must be a subtype of decimal :)
+ "$type" : "string"
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "foo" : 42
+ }
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,49 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema/",
+ "$types" : [
+ {
+ "$name" : "decimal-100",
+ "$kind" : "atomic",
+ "$baseType" : "decimal",
+ "$maxInclusive" : 100
+ },
+ {
+ "$name" : "integer-101",
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$maxInclusive" : 101
+ },
+ {
+ "$name" : "base",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "decimal-100"
+ }
+ },
+ "$open" : false
+ },
+ {
+ "$name" : "derived",
+ "$kind" : "object",
+ "$baseType" : "base",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer-101" (: incompatible $maxInclusive value :)
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "foo" : 42
+ }
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_BASE_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,27 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema/",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer",
+ "$maxInclusive" : 100 (: illegal key for field descriptor :)
+ }
+ }
+ }
+ ]
+ }
+
+let $instance :=
+ {
+ "foo" : 42
+ }
+
+return jsd:jsd-validate( $jsd, "derived", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-object-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-object-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-object-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-open-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-open-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-open-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "string"
+ }
+ },
+ "$open" : 0 (: must be boolean :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-open-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-open-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-open-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-open-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-open-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-open-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,35 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$content" : {
+ "foo" : {
+ "$type" : "decimal"
+ }
+ },
+ "$open" : false
+ },
+ {
+ "$name" : "bar",
+ "$kind" : "object",
+ "$baseType" : "foo",
+ "$content" : {
+ "foo" : {
+ "$type" : "integer"
+ }
+ },
+ "$open" : true (: can not set back to true :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-open-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-open-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-open-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$pattern" : "a+"
+ }
+ ]
+ }
+
+let $instance := "b"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$pattern" : "a+"
+ }
+ ]
+ }
+
+let $instance := "a"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$pattern" : true (: must be string :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$pattern" : "a*+" (: illegal pattern :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-pattern-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : 2
+ }
+ ]
+ }
+
+let $instance := 98.6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : 3
+ }
+ ]
+ }
+
+let $instance := 98.6
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "string",
+ "$totalDigits" : 5 (: illegal facet for string :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : "bar" (: must be string :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,20 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : -1 (: must be >= 0 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,26 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : 5
+ },
+ {
+ "$kind" : "atomic",
+ "$name" : "bar",
+ "$baseType" : "foo",
+ "$totalDigits" : 6 (: must be <= 5 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-04.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,21 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic",
+ "$name" : "foo",
+ "$baseType" : "decimal",
+ "$totalDigits" : 5,
+ "$fractionDigits" : 6 (: must be <= 5 :)
+ }
+ ]
+ }
+
+let $instance := 12345
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-totalDigits-err-05.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_FACET_VALUE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,18 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo"
+ (: "$kind" missing :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-type-top-kind-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,18 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$kind" : "atomic"
+ (: "$name" missing :)
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-type-top-name-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:MISSING_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,13 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : "foo" (: must be array :)
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-01.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-01.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,13 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : { "foo" : 42 } (: must be array :)
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-02.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-02.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_TYPE
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "foo",
+ "$kind" : "object",
+ "$foo" : "bar", (: illegal key :)
+ "$content" : {
+ "foo" : {
+ "$type" : "integer"
+ }
+ }
+ }
+ ]
+ }
+
+let $instance := "foo"
+
+return jsd:jsd-validate( $jsd, "foo", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-types-err-03.spec'
--- test/rbkt/Queries/zorba/jsound/jsound-types-err-03.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-types-err-03.spec 2013-12-06 05:12:46 +0000
@@ -0,0 +1,1 @@
+Error: http://jsound.org/schema:ILLEGAL_KEY
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-union-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-union-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-union-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "integer-or-string",
+ "$kind" : "union",
+ "$content" : [ "integer", "string" ]
+ }
+ ]
+ }
+
+let $instance := 42
+
+return jsd:jsd-validate( $jsd, "integer-or-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-union-02.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-union-02.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-union-02.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "integer-or-string",
+ "$kind" : "union",
+ "$content" : [ "integer", "string" ]
+ }
+ ]
+ }
+
+let $instance := "forty-two"
+
+return jsd:jsd-validate( $jsd, "integer-or-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-union-03.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-union-03.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-union-03.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,24 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "integer-or-string",
+ "$kind" : "union",
+ "$content" : [ "integer", "string" ]
+ },
+ {
+ "$name" : "ios-array",
+ "$kind" : "array",
+ "$content" : [ "integer-or-string" ]
+ }
+ ]
+ }
+
+let $instance := [ 42, "forty-two" ]
+
+return jsd:jsd-validate( $jsd, "ios-array", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added file 'test/rbkt/Queries/zorba/jsound/jsound-union-err-01.jq'
--- test/rbkt/Queries/zorba/jsound/jsound-union-err-01.jq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/jsound-union-err-01.jq 2013-12-06 05:12:46 +0000
@@ -0,0 +1,19 @@
+import module namespace jsd = "http://jsound.io/modules/jsound";
+
+let $jsd :=
+ {
+ "$namespace" : "http://www.example.com/my-schema",
+ "$types" : [
+ {
+ "$name" : "integer-or-string",
+ "$kind" : "union",
+ "$content" : [ "integer", "string" ]
+ }
+ ]
+ }
+
+let $instance := false (: must be integer or string :)
+
+return jsd:jsd-validate( $jsd, "integer-or-string", $instance )
+
+(: vim:set syntax=xquery et sw=2 ts=2: :)
=== added directory 'test/rbkt/Queries/zorba/jsound/schemas'
=== added file 'test/rbkt/Queries/zorba/jsound/schemas/tiny-int.jsd'
--- test/rbkt/Queries/zorba/jsound/schemas/tiny-int.jsd 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsound/schemas/tiny-int.jsd 2013-12-06 05:12:46 +0000
@@ -0,0 +1,11 @@
+{
+ "$namespace" : "http://www.example.com/tiny-int",
+ "$types" : [
+ {
+ "$name" : "tiny-int",
+ "$kind" : "atomic",
+ "$baseType" : "integer",
+ "$maxInclusive" : 5
+ }
+ ]
+}
Follow ups
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: noreply, 2013-12-19
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Zorba Build Bot, 2013-12-19
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Zorba Build Bot, 2013-12-19
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Zorba Build Bot, 2013-12-19
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Zorba Build Bot, 2013-12-19
-
[Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Paul J. Lucas, 2013-12-19
-
Re: [Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Paul J. Lucas, 2013-12-19
-
Re: [Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Paul J. Lucas, 2013-12-14
-
Re: [Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Matthias Brantner, 2013-12-14
-
Re: [Merge] lp:~zorba-coders/zorba/feature-jsoniqpp into lp:zorba
From: Paul J. Lucas, 2013-12-06