zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #05864
[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/96047
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/96047
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-03-06 03:42:48 +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,17 +33,30 @@
ANY_NODE_TYPE, // node()
ITEM_TYPE, // item()
EMPTY_TYPE, // empty-sequence()
- INVALID_TYPE,
+ SCHEMA_ELEMENT_TYPE,
+ SCHEMA_ATTRIBUTE_TYPE,
+ INVALID_TYPE
} kind_t;
+
+ static char const *const kind_string_of[];
typedef enum {
QUANT_ONE,
QUANT_QUESTION,
QUANT_PLUS,
- QUANT_STAR,
+ 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-03-06 03:42:48 +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,22 @@
TypeIdentifier_t
createEmptyType();
+ static
+ TypeIdentifier_t
+ createSchemaElementType(
+ const String& uri,
+ const String& localName,
+ IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
+ );
+
+ static
+ TypeIdentifier_t
+ createSchemaAttributeType(
+ const String& uri,
+ const String& localName,
+ IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
+ );
+
IdentTypes::kind_t
getKind() const;
@@ -129,9 +146,18 @@
TypeIdentifier_t
getContentType() const;
+ std::ostream&
+ emit(std::ostream&) const;
+
private:
TypeIdentifier();
+ std::ostream&
+ emitItemType(std::ostream&) const;
+
+ std::ostream&
+ emitName(std::ostream&) const;
+
IdentTypes::kind_t m_kind;
IdentTypes::quantifier_t m_quantifier;
String m_uri;
@@ -148,5 +174,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 2012-02-16 14:11:02 +0000
+++ src/api/CMakeLists.txt 2012-03-06 03:42:48 +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-03-06 03:42:48 +0000
@@ -0,0 +1,60 @@
+/*
+ * 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",
+ "element",
+ "attribute",
+ "document-node",
+ "processing-instruction",
+ "text",
+ "comment",
+ "node",
+ "item",
+ "empty-sequence",
+ "schema-element",
+ "schema-attribute",
+ "INVALID",
+ 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-03-06 03:42:48 +0000
@@ -20,6 +20,8 @@
#include <zorba/typeident.h>
+#include "diagnostics/assert.h"
+
namespace zorba {
TypeIdentifier::TypeIdentifier()
@@ -101,6 +103,9 @@
TypeIdentifier_t contentType,
IdentTypes::quantifier_t quantifier)
{
+ // not sure why those were 2 different flags, we maintain 2 flags for
+ // compatibility, but they always need to be the same
+ ZORBA_ASSERT(uriWildcard == localNameWildcard);
TypeIdentifier_t ti(new TypeIdentifier());
ti->m_kind = IdentTypes::ELEMENT_TYPE;
ti->m_quantifier = quantifier;
@@ -122,6 +127,9 @@
TypeIdentifier_t contentType,
IdentTypes::quantifier_t quantifier)
{
+ // not sure why those were 2 different flags, we maintain 2 flags for
+ // compatibility, but they always need to be the same
+ ZORBA_ASSERT(uriWildcard == localNameWildcard);
TypeIdentifier_t ti(new TypeIdentifier());
ti->m_kind = IdentTypes::ATTRIBUTE_TYPE;
ti->m_quantifier = quantifier;
@@ -202,11 +210,114 @@
{
TypeIdentifier_t ti(new TypeIdentifier());
ti->m_kind = IdentTypes::EMPTY_TYPE;
-
- return ti;
-}
-
-}
+ ti->m_quantifier = IdentTypes::QUANT_ONE;
+
+ return ti;
+}
+
+TypeIdentifier_t TypeIdentifier::createSchemaElementType(
+ const String& uri,
+ const String& localName,
+ 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;
+
+ return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createSchemaAttributeType(
+ const String& uri,
+ const String& localName,
+ 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;
+
+ return ti;
+}
+
+
+std::ostream& TypeIdentifier::emit(std::ostream& os) const {
+ emitItemType(os);
+ return os << m_quantifier;
+}
+
+
+std::ostream& TypeIdentifier::emitItemType(std::ostream& os) const {
+ if (m_kind == IdentTypes::NAMED_TYPE) {
+ return emitName(os);
+ }
+ os << m_kind;
+ switch (m_kind) {
+ case IdentTypes::DOCUMENT_TYPE:
+ return os << "(" << m_contentType << ")";
+
+ case IdentTypes::ELEMENT_TYPE:
+ case IdentTypes::ATTRIBUTE_TYPE:
+ os << "(";
+ if (m_uriWildcard) {
+ os << "*";
+ } else {
+ emitName(os);
+ }
+ if (! m_contentType.isNull()) {
+ os << "," << m_contentType;
+ }
+ return os << ")";
+
+ case IdentTypes::SCHEMA_ELEMENT_TYPE:
+ case IdentTypes::SCHEMA_ATTRIBUTE_TYPE:
+ os << "(";
+ emitName(os);
+ return os << ")";
+
+ case IdentTypes::ANY_NODE_TYPE:
+ case IdentTypes::COMMENT_TYPE:
+ case IdentTypes::EMPTY_TYPE:
+ case IdentTypes::ITEM_TYPE:
+ case IdentTypes::PI_TYPE:
+ case IdentTypes::TEXT_TYPE:
+ return os << "()";
+
+ case IdentTypes::INVALID_TYPE:
+ return os;
+
+ case IdentTypes::NAMED_TYPE:
+ default:
+ ZORBA_ASSERT(false);
+ }
+}
+
+std::ostream& TypeIdentifier::emitName(std::ostream& os) const {
+ return os << "{" << m_uri << "}" << m_localName;
+}
+
+}
+
+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/typemanagerimpl.cpp'
--- src/types/typemanagerimpl.cpp 2012-01-26 19:56:14 +0000
+++ src/types/typemanagerimpl.cpp 2012-03-06 03:42:48 +0000
@@ -1045,6 +1045,38 @@
case IdentTypes::EMPTY_TYPE:
return create_empty_type();
+ case IdentTypes::SCHEMA_ELEMENT_TYPE:
+ {
+ store::Item_t ename;
+ GENV_ITEMFACTORY->createQName(ename,
+ ident.getUri().c_str(),
+ NULL,
+ ident.getLocalName().c_str());
+
+ return create_node_type(store::StoreConsts::elementNode,
+ ename.getp(),
+ 0,
+ q,
+ false,
+ true);
+ }
+
+ case IdentTypes::SCHEMA_ATTRIBUTE_TYPE:
+ {
+ store::Item_t aname;
+ GENV_ITEMFACTORY->createQName(aname,
+ ident.getUri().c_str(),
+ NULL,
+ ident.getLocalName().c_str());
+
+ return create_node_type(store::StoreConsts::attributeNode,
+ aname.getp(),
+ 0,
+ q,
+ false,
+ true);
+ }
+
default:
break;
}
=== modified file 'src/types/typeops.cpp'
--- src/types/typeops.cpp 2012-01-30 15:23:21 +0000
+++ src/types/typeops.cpp 2012-03-06 03:42:48 +0000
@@ -1179,7 +1179,8 @@
********************************************************************************/
type_ident_ref_t TypeOps::get_type_identifier(
const TypeManager* tm,
- const XQType& type)
+ const XQType& type,
+ bool nested)
{
RootTypeManager& rtm = GENV_TYPESYSTEM;
@@ -1201,7 +1202,7 @@
const NodeXQType& nt = static_cast<const NodeXQType&>(type);
type_ident_ref_t content_type = (nt.get_content_type() != NULL ?
- get_type_identifier(tm, *nt.get_content_type()) :
+ get_type_identifier(tm, *nt.get_content_type(), true) :
type_ident_ref_t());
const store::Item* nodeName = nt.get_node_name();
@@ -1224,29 +1225,53 @@
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, q);
+ }
+ else
+ {
+ String uri;
+ String local;
+ if (nodeName)
+ {
+ uri = nodeName->getNamespace().c_str();
+ local = nodeName->getLocalName().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, q);
+ }
+ else
+ {
+ String uri;
+ String local;
+ if (nodeName)
+ {
+ uri = nodeName->getNamespace().c_str();
+ local = nodeName->getLocalName().c_str();
+ }
+ return TypeIdentifier::createAttributeType(uri,
+ nodeName == NULL,
+ local,
+ nodeName == NULL,
+ content_type,
+ q);
+ }
default:
// cannot happen
ZORBA_ASSERT(false);
@@ -1281,7 +1306,15 @@
return TypeIdentifier::createEmptyType();
case XQType::USER_DEFINED_KIND:
- //TODO for Vinayak return type identifier
+ {
+ ZORBA_ASSERT(nested || is_atomic(tm, type));
+ store::Item* lQname = type.get_qname().getp();
+ return TypeIdentifier::createNamedType(
+ Unmarshaller::newString( lQname->getNamespace() ),
+ Unmarshaller::newString( lQname->getLocalName() ),
+ q
+ );
+ }
default:
break;
}
=== modified file 'src/types/typeops.h'
--- src/types/typeops.h 2012-01-11 10:30:49 +0000
+++ src/types/typeops.h 2012-03-06 03:42:48 +0000
@@ -256,7 +256,8 @@
*/
static type_ident_ref_t get_type_identifier(
const TypeManager* tm,
- const XQType& type);
+ const XQType& type,
+ bool nested = false);
/*
* Writes a textual representation of the given type to the output stream.
=== modified file 'test/unit/CMakeLists.txt'
--- test/unit/CMakeLists.txt 2012-02-27 14:46:27 +0000
+++ test/unit/CMakeLists.txt 2012-03-06 03:42:48 +0000
@@ -71,6 +71,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-03-06 03:42:48 +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-03-06 03:42:48 +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 comment();
+declare collection mod6:coll11 as processing-instruction()?;
+declare collection mod6:coll12 as text()+;
+declare collection mod6:coll13 as node()*;
=== added file 'test/unit/schema1.xsd'
--- test/unit/schema1.xsd 1970-01-01 00:00:00 +0000
+++ test/unit/schema1.xsd 2012-03-06 03:42:48 +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-03-06 03:42:48 +0000
@@ -259,6 +259,165 @@
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);
+ if (! aColMgr->isDeclaredCollection(lCollName)) {
+ std::cout << "no collection "
+ << lCollName.getStringValue().c_str()
+ << std::endl;
+ return false;
+ }
+ 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::quantifier_t lC03Quants[] = { IdentTypes::QUANT_STAR,
+ IdentTypes::QUANT_ONE };
+ if (!check_types(lColMgr, lFac, "coll03", 2, 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::quantifier_t lC06Quants[] = { IdentTypes::QUANT_STAR };
+ if (!check_types(lColMgr, lFac, "coll06", 1, 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::quantifier_t lC09Quants[] = { IdentTypes::QUANT_STAR };
+ if (!check_types(lColMgr, lFac, "coll09", 1, lC09Kinds, lC09Quants)) {
+ return false;
+ }
+
+ IdentTypes::kind_t lC10Kinds[] = { IdentTypes::COMMENT_TYPE };
+ IdentTypes::quantifier_t lC10Quants[] = { IdentTypes::QUANT_ONE };
+ if (!check_types(lColMgr, lFac, "coll10", 1, lC10Kinds, lC10Quants)) {
+ return false;
+ }
+
+ IdentTypes::kind_t lC11Kinds[] = { IdentTypes::PI_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;
+ }
+
+ IdentTypes::kind_t lC13Kinds[] = { IdentTypes::ANY_NODE_TYPE };
+ IdentTypes::quantifier_t lC13Quants[] = { IdentTypes::QUANT_STAR };
+ if (!check_types(lColMgr, lFac, "coll13", 1, lC13Kinds, lC13Quants)) {
+ return false;
+ }
+
+ return true;
+}
+
int
staticcollectionmanager(int argc, char* argv[])
{
@@ -287,6 +446,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
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: noreply, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Markos Zaharioudakis, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Markos Zaharioudakis, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Zorba Build Bot, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06
-
Re: [Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06
-
[Merge] lp:~zorba-coders/zorba/bug924987 into lp:zorba
From: Till Westmann, 2012-03-06