← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba

 

Till Westmann has proposed merging lp:~zorba-coders/zorba/bug924987 into lp:zorba.

Requested reviews:
  Till Westmann (tillw)
  Markos Zaharioudakis (markos-za)
Related bugs:
  Bug #924987 in Zorba: "Failure getting type of a collection via the StaticCollectionManager"
  https://bugs.launchpad.net/zorba/+bug/924987

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug924987/+merge/91144

fixes bug 924987
- extended TypeIdentifier to also support schema-element, schema-attribute 
  and namespace-node sequence types
- fixed TypeOps::get_type_identifier
- added a test to the staticcollectionmanager unit test
- added operator<< for TypeIdentifier
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug924987/+merge/91144
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/identtypes.h'
--- include/zorba/identtypes.h	2011-09-21 14:49:55 +0000
+++ include/zorba/identtypes.h	2012-02-01 18:52:21 +0000
@@ -17,6 +17,7 @@
 #define ZORBA_TYPEIDENT_TYPES_API_H
 
 #include <zorba/config.h>
+#include <iostream>
 
 namespace zorba {
 class ZORBA_DLL_PUBLIC IdentTypes {
@@ -32,8 +33,13 @@
     ANY_NODE_TYPE, // node()
     ITEM_TYPE,     // item()
     EMPTY_TYPE,    // empty-sequence()
+    SCHEMA_ELEMENT_TYPE,
+    SCHEMA_ATTRIBUTE_TYPE,
+    NAMESPACE_TYPE,
     INVALID_TYPE,
   } kind_t;
+  
+  static char const *const kind_string_of[];
 
   typedef enum {
     QUANT_ONE,
@@ -41,8 +47,17 @@
     QUANT_PLUS,
     QUANT_STAR,
   } quantifier_t;
+  
+  static char const *const quantifier_string_of[];
 };
 }
 
+namespace std {
+
+ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::IdentTypes::kind_t ik);
+ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::IdentTypes::quantifier_t iq);
+
+}
+
 #endif
 /* vim:set et sw=2 ts=2: */

=== modified file 'include/zorba/typeident.h'
--- include/zorba/typeident.h	2011-06-14 17:26:33 +0000
+++ include/zorba/typeident.h	2012-02-01 18:52:21 +0000
@@ -20,6 +20,7 @@
 #include <zorba/api_shared_types.h>
 #include <zorba/identtypes.h>
 #include <zorba/zorba_string.h>
+#include <iostream>
 
 namespace zorba {
 
@@ -61,7 +62,7 @@
     createAttributeType(
         const String& uri,
         bool uriWildcard,
-        const String& localNameName,
+        const String& localName,
         bool localNameWildcard,
         TypeIdentifier_t contentType,
         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
@@ -108,6 +109,30 @@
     TypeIdentifier_t
     createEmptyType();
 
+    static
+    TypeIdentifier_t
+    createSchemaElementType(
+        const String& uri,
+        const String& localName,
+        TypeIdentifier_t contentType,
+        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
+        );
+  
+    static
+    TypeIdentifier_t
+    createSchemaAttributeType(
+        const String& uri,
+        const String& localName,
+        TypeIdentifier_t contentType,
+        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
+        );
+  
+    static
+    TypeIdentifier_t
+    createNamespaceType(
+        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
+        );
+  
     IdentTypes::kind_t
     getKind() const;
 
@@ -129,6 +154,9 @@
     TypeIdentifier_t
     getContentType() const;
 
+    std::ostream&
+    emit(std::ostream&) const;
+
   private:
     TypeIdentifier();
 
@@ -148,5 +176,12 @@
 
 } /* namespace zorba */
 
+namespace std {
+
+ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier& ti);
+ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier_t ti);
+
+}
+
 #endif /* ZORBA_TYPES_TYPEIDENT_H */
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/api/CMakeLists.txt'
--- src/api/CMakeLists.txt	2011-08-31 13:17:59 +0000
+++ src/api/CMakeLists.txt	2012-02-01 18:52:21 +0000
@@ -27,6 +27,7 @@
     zorba_string.cpp
     itemfactoryimpl.cpp
     item.cpp
+    identtypesimpl.cpp
     typeidentimpl.cpp
     unmarshaller.cpp
     xmldatamanagerimpl.cpp

=== added file 'src/api/identtypesimpl.cpp'
--- src/api/identtypesimpl.cpp	1970-01-01 00:00:00 +0000
+++ src/api/identtypesimpl.cpp	2012-02-01 18:52:21 +0000
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#include <zorba/identtypes.h>
+
+namespace zorba {
+  
+char const *const IdentTypes::kind_string_of[] = {
+  "NAMED_TYPE",
+  "ELEMENT_TYPE",
+  "ATTRIBUTE_TYPE",
+  "DOCUMENT_TYPE",
+  "PI_TYPE",
+  "TEXT_TYPE",
+  "COMMENT_TYPE",
+  "ANY_NODE_TYPE",
+  "ITEM_TYPE",
+  "EMPTY_TYPE",
+  "SCHEMA_ELEMENT_TYPE",
+  "SCHEMA_ATTRIBUTE_TYPE",
+  "NAMESPACE_TYPE",
+  "INVALID_TYPE",
+  0
+};
+
+char const *const IdentTypes::quantifier_string_of[] = {
+  "",
+  "?",
+  "+",
+  "*",
+  0
+};
+  
+}
+
+namespace std {
+
+ostream& operator<<(ostream& o, const zorba::IdentTypes::kind_t ik) {
+  return o << zorba::IdentTypes::kind_string_of[ik];
+}
+
+ostream& operator<<(ostream& o, const zorba::IdentTypes::quantifier_t iq) {
+  return o << zorba::IdentTypes::quantifier_string_of[iq];
+}
+
+}
+
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/api/typeidentimpl.cpp'
--- src/api/typeidentimpl.cpp	2011-09-15 11:46:01 +0000
+++ src/api/typeidentimpl.cpp	2012-02-01 18:52:21 +0000
@@ -206,7 +206,78 @@
   return ti;
 }
 
-}
+TypeIdentifier_t TypeIdentifier::createSchemaElementType(
+    const String& uri,
+    const String& localName,
+    TypeIdentifier_t contentType,
+    IdentTypes::quantifier_t quantifier)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::SCHEMA_ELEMENT_TYPE;
+  ti->m_quantifier = quantifier;
+  ti->m_uri = uri;
+  ti->m_uriWildcard = false;
+  ti->m_localName = localName;
+  ti->m_localNameWildcard = false;
+  ti->m_contentType = contentType;
+  
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createSchemaAttributeType(
+    const String& uri,
+    const String& localName,
+    TypeIdentifier_t contentType,
+    IdentTypes::quantifier_t quantifier)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::SCHEMA_ATTRIBUTE_TYPE;
+  ti->m_quantifier = quantifier;
+  ti->m_uri = uri;
+  ti->m_uriWildcard = false;
+  ti->m_localName = localName;
+  ti->m_localNameWildcard = false;
+  ti->m_contentType = contentType;
+  
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createNamespaceType(IdentTypes::quantifier_t quantifier)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::NAMESPACE_TYPE;
+  ti->m_quantifier = quantifier;
+  
+  return ti;
+}
+
+
+std::ostream& TypeIdentifier::emit(std::ostream& os) const {
+  os << '{' << m_kind << m_quantifier
+     << ", {" << (m_uriWildcard ? "*" : m_uri) << "}" 
+     << (m_localNameWildcard ? "*" : m_localName);
+  if ( ! m_contentType.isNull() ) {
+    os << ", " << m_contentType;
+  }
+  return os << '}';
+}
+
+}
+
+namespace std {
+
+ostream& operator<<(ostream& o, const zorba::TypeIdentifier& ti) {
+  return ti.emit(o);
+}
+
+ostream& operator<<(ostream& o, const zorba::TypeIdentifier_t ti) {
+  return ti->emit(o);
+}
+
+}
+
 
 #endif
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/types/typeops.cpp'
--- src/types/typeops.cpp	2012-01-30 15:23:21 +0000
+++ src/types/typeops.cpp	2012-02-01 18:52:21 +0000
@@ -1224,29 +1224,59 @@
       return TypeIdentifier::createDocumentType(content_type, q);
 
     case store::StoreConsts::elementNode:
-    {
-      String uri( Unmarshaller::newString( nodeName->getNamespace() ) );
-      String local( Unmarshaller::newString( nodeName->getLocalName() ) );
-
-      return TypeIdentifier::createElementType(uri,
-                                               nodeName == NULL,
-                                               local,
-                                               nodeName == NULL,
-                                               content_type,
-                                               q);
-    }  
-    case store::StoreConsts::attributeNode:
-    {
-      String uri( Unmarshaller::newString( nodeName->getNamespace() ) );
-      String local( Unmarshaller::newString( nodeName->getLocalName() ) );
-
-      return TypeIdentifier::createAttributeType(uri,
+      if (nt.is_schema_test()) 
+      {
+        ZORBA_ASSERT(nodeName);
+        String uri( Unmarshaller::newString( nodeName->getNamespace() ) );
+        String local( Unmarshaller::newString( nodeName->getLocalName() ) );
+        return TypeIdentifier::createSchemaElementType(uri,
+                                                       local,
+                                                       content_type,
+                                                       q);
+      }
+      else
+      {
+        String uri;
+        String local;
+        if (nodeName)
+        {
+          uri   = nodeName->getNamespace().c_str();
+          local = nodeName->getNamespace().c_str();
+        }
+        return TypeIdentifier::createElementType(uri,
                                                  nodeName == NULL,
                                                  local,
                                                  nodeName == NULL,
                                                  content_type,
-                                                 q);
-    }
+                                                 q); 
+      }  
+    case store::StoreConsts::attributeNode:
+      if (nt.is_schema_test()) 
+      {
+        ZORBA_ASSERT(nodeName);
+        String uri( Unmarshaller::newString( nodeName->getNamespace() ) );
+        String local( Unmarshaller::newString( nodeName->getLocalName() ) );
+        return TypeIdentifier::createSchemaAttributeType(uri,
+                                                       local,
+                                                       content_type,
+                                                       q);
+      }
+      else
+      {
+        String uri;
+        String local;
+        if (nodeName)
+        {
+          uri   = nodeName->getNamespace().c_str();
+          local = nodeName->getNamespace().c_str();
+        }
+        return TypeIdentifier::createAttributeType(uri,
+                                                   nodeName == NULL,
+                                                   local,
+                                                   nodeName == NULL,
+                                                   content_type,
+                                                   q);
+      }
     default:
       // cannot happen
       ZORBA_ASSERT(false);
@@ -1281,7 +1311,14 @@
     return TypeIdentifier::createEmptyType();
 
   case XQType::USER_DEFINED_KIND:
-    //TODO for Vinayak return type identifier
+  {
+    store::Item* lQname = type.get_qname().getp();
+    return TypeIdentifier::createNamedType(
+      Unmarshaller::newString( lQname->getNamespace() ), 
+      Unmarshaller::newString( lQname->getLocalName() ),
+      q
+    );
+  }
   default:
     break;
   }

=== modified file 'test/unit/CMakeLists.txt'
--- test/unit/CMakeLists.txt	2012-01-27 08:19:06 +0000
+++ test/unit/CMakeLists.txt	2012-02-01 18:52:21 +0000
@@ -69,6 +69,10 @@
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/module2.xq ${CMAKE_CURRENT_BINARY_DIR}/module2.xq)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/module3.xq ${CMAKE_CURRENT_BINARY_DIR}/module3.xq)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/module4.xq ${CMAKE_CURRENT_BINARY_DIR}/module4.xq)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/module5.xq ${CMAKE_CURRENT_BINARY_DIR}/module5.xq)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/module6.xq ${CMAKE_CURRENT_BINARY_DIR}/module6.xq)
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/schema1.xsd ${CMAKE_CURRENT_BINARY_DIR}/schema1.xsd)
 
 SET(UNIT_TESTS_SRCS
   path_resolver.cpp

=== added file 'test/unit/module5.xq'
--- test/unit/module5.xq	1970-01-01 00:00:00 +0000
+++ test/unit/module5.xq	2012-02-01 18:52:21 +0000
@@ -0,0 +1,20 @@
+(:
+ : Copyright 2006-2009 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.
+:)
+
+import module namespace mod6 = "http://www.mod6.com/"; at "file:///${CMAKE_CURRENT_BINARY_DIR}/module6.xq";
+
+1+1
+

=== added file 'test/unit/module6.xq'
--- test/unit/module6.xq	1970-01-01 00:00:00 +0000
+++ test/unit/module6.xq	2012-02-01 18:52:21 +0000
@@ -0,0 +1,38 @@
+(:
+ : Copyright 2006-2009 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.
+:)
+
+module namespace mod6 = "http://www.mod6.com/";;
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";;
+
+import schema namespace s = "http://www.zorba-xquery.com/schemas/simple"; at "file:///${CMAKE_CURRENT_BINARY_DIR}/schema1.xsd";
+
+declare collection mod6:coll01 as document-node(element(s:product))*;
+declare collection mod6:coll02 as document-node(element(*, s:ProductType))*;
+declare collection mod6:coll03 as document-node(schema-element(s:product))*;
+
+declare collection mod6:coll04 as element(s:product)*;
+declare collection mod6:coll05 as element(*, s:ProductType)*;
+declare collection mod6:coll06 as schema-element(s:product)*;
+
+declare collection mod6:coll07 as attribute(s:zip-code)*;
+declare collection mod6:coll08 as attribute(*, s:ZipType)*;
+declare collection mod6:coll09 as schema-attribute(s:zip-code)*;
+
+declare collection mod6:coll10 as text();
+declare collection mod6:coll11 as text()?;
+declare collection mod6:coll12 as text()+;
+

=== added file 'test/unit/schema1.xsd'
--- test/unit/schema1.xsd	1970-01-01 00:00:00 +0000
+++ test/unit/schema1.xsd	2012-02-01 18:52:21 +0000
@@ -0,0 +1,21 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  targetNamespace="http://www.zorba-xquery.com/schemas/simple"; 
+            xmlns="http://www.zorba-xquery.com/schemas/simple"; 
+  elementFormDefault="qualified">
+
+  <xs:element name="product" type="ProductType"/>
+
+  <xs:complexType name="ProductType">
+      <xs:attribute name="data" type="xs:base64Binary"/>
+      <xs:attribute name="string" type="xs:string"/>
+  </xs:complexType>
+  
+  <xs:attribute name="zip-code" type="ZipType"/>
+  
+  <xs:simpleType name="ZipType">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+</xs:schema>
\ No newline at end of file

=== modified file 'test/unit/staticcollectionmanager.cpp'
--- test/unit/staticcollectionmanager.cpp	2012-01-11 17:30:25 +0000
+++ test/unit/staticcollectionmanager.cpp	2012-02-01 18:52:21 +0000
@@ -259,6 +259,159 @@
   return i == 1;
 }
 
+bool
+check_types(StaticCollectionManager* aColMgr,
+            ItemFactory* aFac,
+            const char* const aCollName, 
+            int aDepth,
+            IdentTypes::kind_t someKinds[],
+            IdentTypes::quantifier_t someQuantifiers[])
+{
+  Item lCollName = aFac->createQName("http://www.mod6.com/";, aCollName);
+  aColMgr->createCollection(lCollName);
+  Collection_t lCollection = aColMgr->getCollection(lCollName);
+  zorba::TypeIdentifier_t lType = lCollection->getType();
+  std::cout << lType << std::endl;
+
+  for (int i = 0; i < aDepth; ++i) {    
+    if (lType->getKind() != someKinds[i]) {
+      std::cout << lType << std::endl;
+      return false;
+    }
+    if (lType->getQuantifier() != someQuantifiers[i]) {
+      std::cout << lType << std::endl;
+      return false;
+    }
+    lType = lType->getContentType();
+  }
+  assert(lType.isNull());
+
+  aColMgr->deleteCollection(lCollName);
+  return true;
+}
+
+bool
+staticcollectionamanger5(zorba::Zorba* z)
+{
+  std::ifstream lIn("module5.xq");
+  zorba::XQuery_t lQuery = z->createQuery();
+
+  try {
+    Zorba_CompilerHints lHints;
+    lQuery->compile(lIn, lHints);
+  } catch (zorba::XQueryException &e) {
+    std::cout << e << std::endl;
+    return false;
+  } catch (...) {
+    std::cout << "compilation failed" << std::endl;
+    return false;
+  }
+
+  StaticCollectionManager* lColMgr = lQuery->getStaticCollectionManager();
+  ItemFactory* lFac = z->getItemFactory();
+
+  IdentTypes::kind_t       lC01Kinds[]  = { IdentTypes::DOCUMENT_TYPE,
+                                            IdentTypes::ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC01Quants[] = { IdentTypes::QUANT_STAR,
+                                            IdentTypes::QUANT_ONE, 
+                                            // this '*' is probably a bug
+                                            IdentTypes::QUANT_STAR }; 
+  if (!check_types(lColMgr, lFac, "coll01", 3, lC01Kinds, lC01Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC02Kinds[]  = { IdentTypes::DOCUMENT_TYPE,
+                                            IdentTypes::ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC02Quants[] = { IdentTypes::QUANT_STAR,
+                                            IdentTypes::QUANT_ONE, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll02", 3, lC02Kinds, lC02Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC03Kinds[]  = { IdentTypes::DOCUMENT_TYPE,
+                                            IdentTypes::SCHEMA_ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC03Quants[] = { IdentTypes::QUANT_STAR,
+                                            IdentTypes::QUANT_ONE, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll03", 3, lC03Kinds, lC03Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC04Kinds[]  = { IdentTypes::ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC04Quants[] = { IdentTypes::QUANT_STAR, 
+                                            // this '*' is probably a bug
+                                            IdentTypes::QUANT_STAR }; 
+  if (!check_types(lColMgr, lFac, "coll04", 2, lC04Kinds, lC04Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC05Kinds[]  = { IdentTypes::ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC05Quants[] = { IdentTypes::QUANT_STAR, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll05", 2, lC05Kinds, lC05Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC06Kinds[]  = { IdentTypes::SCHEMA_ELEMENT_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC06Quants[] = { IdentTypes::QUANT_STAR, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll06", 2, lC06Kinds, lC06Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC07Kinds[]  = { IdentTypes::ATTRIBUTE_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC07Quants[] = { IdentTypes::QUANT_STAR, 
+                                            // this '*' is probably a bug
+                                            IdentTypes::QUANT_STAR }; 
+  if (!check_types(lColMgr, lFac, "coll07", 2, lC07Kinds, lC07Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC08Kinds[]  = { IdentTypes::ATTRIBUTE_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC08Quants[] = { IdentTypes::QUANT_STAR, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll08", 2, lC08Kinds, lC08Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC09Kinds[]  = { IdentTypes::SCHEMA_ATTRIBUTE_TYPE,
+                                            IdentTypes::NAMED_TYPE };
+  IdentTypes::quantifier_t lC09Quants[] = { IdentTypes::QUANT_STAR, 
+                                            IdentTypes::QUANT_ONE };
+  if (!check_types(lColMgr, lFac, "coll09", 2, lC09Kinds, lC09Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC10Kinds[]  = { IdentTypes::TEXT_TYPE };
+  IdentTypes::quantifier_t lC10Quants[] = { IdentTypes::QUANT_ONE }; 
+  if (!check_types(lColMgr, lFac, "coll10", 1, lC10Kinds, lC10Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC11Kinds[]  = { IdentTypes::TEXT_TYPE };
+  IdentTypes::quantifier_t lC11Quants[] = { IdentTypes::QUANT_QUESTION };
+  if (!check_types(lColMgr, lFac, "coll11", 1, lC11Kinds, lC11Quants)) {
+    return false;
+  }
+  
+  IdentTypes::kind_t       lC12Kinds[]  = { IdentTypes::TEXT_TYPE };
+  IdentTypes::quantifier_t lC12Quants[] = { IdentTypes::QUANT_PLUS };
+  if (!check_types(lColMgr, lFac, "coll12", 1, lC12Kinds, lC12Quants)) {
+    return false;
+  }
+  
+  return true;
+}
+
 int
 staticcollectionmanager(int argc, char* argv[])
 {
@@ -287,6 +440,11 @@
     return 4;
   std::cout << std::endl;
 
+  std::cout << "executing example 5" << std::endl;
+  if (!staticcollectionamanger5(z))
+    return 5;
+  std::cout << std::endl;
+
   return 0;
 }
 


Follow ups