6 #include <zorba/zorba.h>
7 #include <zorba/store_manager.h>
8 #include <zorba/serializer.h>
9 #include <zorba/singleton_item_sequence.h>
10 #include <zorba/zorba_exception.h>
13 using namespace zorba;
16 example_1(Zorba* aZorba)
18 XQuery_t lQuery = aZorba->compileQuery("1+2");
20 std::cout << lQuery << std::endl;
26 example_2(Zorba* aZorba)
28 XQuery_t lQuery = aZorba->createQuery();
29 std::string path( "/home/adam/proj/marc2bibframe/xbin/zorba3-0.xqy");
31 std::unique_ptr<std::istream> qfile;
33 qfile.reset( new std::ifstream( path.c_str() ) );
35 Zorba_CompilerHints lHints;
37 // lQuery->setFileName("http://base/");
38 lQuery->setFileName("/home/adam/proj/marc2bibframe/xbin/");
40 lQuery->compile(*qfile, lHints);
42 zorba::DynamicContext* lDynamicContext = lQuery->getDynamicContext();
44 zorba::Item lItem = aZorba->getItemFactory()->createString("http://base/");
45 lDynamicContext->setVariable("baseuri", lItem);
47 lItem = aZorba->getItemFactory()->createString(
48 "/home/adam/proj/yaz/test/marc6.xml");
49 lDynamicContext->setVariable("marcxmluri", lItem);
51 lItem = aZorba->getItemFactory()->createString("rdfxml");
52 lDynamicContext->setVariable("serialization", lItem);
54 std::cout << lQuery << std::endl;
56 lItem = aZorba->getItemFactory()->createString(
57 "/home/adam/proj/yaz/test/marc7.xml");
58 lDynamicContext->setVariable("marcxmluri", lItem);
64 std::string result = ss.str();
66 std::cout << result << std::endl;
71 int main(int argc, char **argv)
73 void* lStore = StoreManager::getStore();
74 Zorba *lZorba = Zorba::getInstance(lStore);
83 StoreManager::shutdownStore(lStore);
89 * c-file-style: "Stroustrup"
90 * indent-tabs-mode: nil
92 * vim: shiftwidth=4 tabstop=8 expandtab