BaseX

how to return the third book from this bookstore using FLOWR in XQuery?

百般思念 提交于 2019-12-11 17:13:41
问题 How can I return the third book from this bookstore? declare context item := document{ <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author

No updating expression allowed Basex

六月ゝ 毕业季﹏ 提交于 2019-12-11 14:31:07
问题 I am using BaseX version 8.6.6 i am getting the error while updating database expression must all be updating or return empty sequence below is the code: declare %private %updating function local:ingest-job() { let $contentpath := 'D:\2019\bloomsbury-ingest-content\TEI.zip' let $archive := file:read-binary($contentpath) for $entry in archive:entries($archive)[fn:ends-with(., '.xml')] let $rootNode := fn:name(fn:parse-xml(archive:extract-text($archive, $entry))/*) return let $docId := fn:parse

how to use Xquery and FLOWR to iterate and return each result?

时光怂恿深爱的人放手 提交于 2019-12-11 10:55:15
问题 I'm looking to iterate a sample bookstore returning each book as a result. How is this accomplished with XQuery and FLOWR? My best attempt so far: thufir@dur:~/basex/w3schools$ thufir@dur:~/basex/w3schools$ basex each.xq <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29

How to install Basex for command line on OS X using Homebrew?

送分小仙女□ 提交于 2019-12-11 10:46:25
问题 I'm trying to install BaseX using Homebrew on OS X: $ brew cask install basex ==> We need to make Caskroom for the first time at /opt/homebrew-cask/Caskroom ==> We'll set permissions properly so we won't need sudo in the future Password: ==> Downloading http://files.basex.org/releases/8.1.1/BaseX811.app.tar.bz2 ######################################################################## 100.0% ==> Symlinking App 'BaseX.app' to '/Users/user/Applications/BaseX.app' 🍺 basex staged at '/opt/homebrew

Incomplete FLWOR expression: expecting 'return'

天涯浪子 提交于 2019-12-10 22:16:02
问题 I am having some trouble with the if-then-else command of the XQuery. Currently I am using BaseX to edit XQuery (if that matters!) if ($item/pf3:Current/pf3:Name) then ( let $Name := "None" ) else ( let $Name := data($item/pf3:Current/pf3:Name) ) This piece throws an error saying: [XPST0003] Incomplete FLWOR expression: expecting 'return'. 回答1: There is a small problem with your xquery. Here is the corrected version - let $Name := if ($item/pf3:Current/pf3:Name) then "None" else data($item

BaseX - Out of memory when using enclosing xml in XQuery

时光怂恿深爱的人放手 提交于 2019-12-10 21:04:24
问题 I've been trying to query a BaseX db which contains more than 1500000 items. When i run this query for $item in collection('coll')//item return $item (: returns an xml element :) it executes in less than a second. But when i try to return the result in an xml I get an "Out of main memory" error. <xml>{ for $item in collection('coll')//item return $item }</xml> This is something that makes me want to abandon the native xml db approach (same happens with other DBs, such as eXistDB), so if

BaseX: where to declare the XML document on which to perform a query

倖福魔咒の 提交于 2019-12-10 15:54:27
问题 With the program BaseX I was able to use XPath and XQuery in order to query an XML document located at my home directory, but I have a problem with doing the same in XSLT. The document I'm querying is BookstoreQ.xml. XPath version, running totally fine: doc("/home/ioannis/Desktop/BookstoreQ.xml")/Bookstore/Book/Title XSLT code which I want to execute: <xsl:stylesheet version = "2.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:output method= "xml" indent = "yes" omit-xml

run xpath from xquery against a database?

北城余情 提交于 2019-12-08 11:37:39
问题 How do I run an xpath query from within an xquery script with the basex GUI? successful xpath query of a database: failed xquery attempt: The simplest possible xquery code for this database: thufir@dur:~/basex$ thufir@dur:~/basex$ cat db_list_items.xq let $db := db:open("list") return root()/descendant::li/a/text() thufir@dur:~/basex$ Not quite sure how to return results above. error log from the basex GUI: Error: Stopped at /home/thufir/basex/db_list_items.xq, 4/12: [XPDY0002] root(): no

BaseX query optimization on join

放肆的年华 提交于 2019-12-08 08:11:55
问题 After the issue in the following Stackoverflow is fixed, I have another problem when I try to make a join as below. The last query takes about 250ms while the first two take only 16ms. Is there a better way to perform join between two items? Note: You can find the test data from this link. let $PlGeTys := /root/PlGeTys/PlGeTy[ isOfPlCt/@href=/root/PlCts/PlCt[ environment='AIR' ]/@id ] let $PlSpTys := /root/PlSpTys/PlSpTy[ isOfPlGeTy/@href=$PlGeTys/@id ] for $PlGeTy in $PlGeTys, $PlSpTy in

xquery: how to remove unused namespace in xml node?

大憨熊 提交于 2019-12-08 08:06:05
问题 I have a xml document same as: <otx xmlns="http://iso.org/OTX/1.0.0" xmlns:i18n="http://iso.org/OTX/1.0.0/i18n" xmlns:diag="http://iso.org/OTX/1.0.0/DiagCom" xmlns:measure="http://iso.org/OTX/1.0.0/Measure" xmlns:string="http://iso.org/OTX/1.0.0/StringUtil" xmlns:dmd="http://iso.org/OTX/1.0.0/Auxiliaries/DiagMetaData" xmlns:fileXml="http://vwag.de/OTX/1.0.0/XmlFile" xmlns:log="http://iso.org/OTX/1.0.0/Logging" xmlns:file="http://vwag.de/OTX/1.0.0/File" xmlns:dataPlus="http://iso.org/OTX/1.0.0