甲减和甲亢有什么区别| 酒精胶是粘什么的| 无能为力是什么意思| 婴儿枕头里面装什么好| 4.22是什么日子| 入园体检都检查什么| 嘴唇红是什么原因| 出岫是什么意思| 放疗是什么意思| 白头发吃什么维生素能变黑| 右手麻是什么原因| jacquemus是什么牌子| 词讼是什么意思| 2001年出生属什么| 毛肚是什么动物身上的| 心绞痛吃什么药好| 1999是什么年| 什么叫基因| 檄文是什么意思| 劝退是什么意思| 灰色是什么颜色调出来的| 熹字五行属什么| 什么是卫星| 汗疱疹涂什么药| 羊肉馅饺子配什么菜好| 折寿是什么意思| 二甲双胍缓释片什么时候吃最好| 指甲盖上有竖纹是什么原因| 胸口长痘是什么原因| 风湿有什么症状表现| 生辉是什么意思| 秘辛是什么意思| 卡司是什么意思| 什么情况下需做肠镜| 精液是什么颜色| 芥酸对身体有什么危害| 大姨妈来吃什么好| 可字五行属什么| 皮疹用什么药膏最好| 7.4是什么星座| 湿疹是什么原因造成的| coo是什么| 棱角分明是什么意思| 省纪委常委是什么级别| 透析到什么程度会死亡| 七月份有什么水果| 树叶为什么是绿色的| 吃什么最养胃修复胃| 重楼的别名叫什么| 射手女喜欢什么样的男生| 导管是什么意思| 为什么早上起来恶心想吐| 跳梁小丑指什么生肖| 梦见老公穿新衣服是什么意思| bg什么意思| 94年什么生肖| 豆干和什么炒好吃| 美国为什么打伊拉克| 落差是什么意思| 腌牛肉放什么调料| 艺考音乐考什么| ipadair2什么时候上市的| 三点水的字大多与什么有关| 不结婚的叫什么族| 三点水一个半读什么| 保肝降酶药首选什么药| 阴唇外翻是什么原因| 乳铁蛋白对宝宝有什么好处| 鹿晗什么时候回国的| 高血脂会引起什么疾病| 上午九点到十一点是什么时辰| 六月不搬家是什么意思| 体格检查是什么意思| lm是什么品牌| 岁寒三友是指什么| 发痧是什么原因造成的| 三教九流什么意思| 什么利尿| 4月15号是什么星座| 心脏是什么组织| 阿胶适合什么人吃| 为什么近视不可逆| 放养是什么意思| 九月29号是什么星座| 口述是什么意思| 羽衣甘蓝是什么| 属猴本命佛是什么佛| 向日葵什么时候种| ts是什么| 什么命要承受丧子之痛| 高锰酸钾用什么能洗掉| 系统性红斑狼疮挂什么科| 鱼白是什么东西| 感冒吃什么水果比较好| 乳房是什么意思| 下海什么意思| 孩子为什么要躲百天| 白茶什么季节喝好| 近视眼睛什么牌子好| 胃息肉是什么原因引起的| 南京区委书记什么级别| 化险为夷的夷什么意思| 焯水是什么意思| 蜱虫用什么药可以消灭| 什么是势能| 狗为什么不能吃洋葱| 蝴蝶宝贝是什么病| 异烟肼是什么药| 22年什么婚| 地球是什么| 感激不尽是什么意思| 挑染是什么意思| 脖子短适合什么发型| vg是什么意思| 吃什么水果容易排便| nt是什么币| 浪琴军旗什么档次| 什么减肥药最安全| 兔死狗烹是什么生肖| 梦到蜈蚣是什么意思| 2e是什么意思| 虫字旁与什么有关| 18k金和24k金有什么区别| 桃花什么生肖| 崩漏是什么意思| 白虎什么意思| 血小板过低有什么危害| 月亮五行属什么| 环切是什么意思| 6月16号是什么星座| 家里进蝴蝶有什么预兆| 国家主席是什么级别| 炙热是什么意思| 第三代身份证什么时候开始办理| 为什么土豆不能炒鸡蛋| 狐臭是什么原因引起的| 盐酸氟桂利嗪胶囊治什么病| 什么故事| 肠道炎有什么症状| 慰安妇是什么意思| 胆囊息肉有什么症状| 血糖有点高吃什么食物好| 小儿厌食吃什么药最好| 胃热口干口苦口臭吃什么药好| 鸡杂是什么| 吃维生素b2有什么好处和副作用| tf口红是什么牌子| 27岁属什么| 门诊号是什么意思| 艾草长什么样| 什么的月光| 氩气是什么气体| 龙的五行属性是什么| 脚板麻木是什么原因| 4月4日是什么日子| 男人有美人尖代表什么| 肛门潮湿瘙痒用什么药最好| 忙什么呢幽默的回答| 深井冰是什么意思| 瓜子脸适合什么眼镜| 碧玉五行属什么| 包二奶什么意思| 投诉医院打什么电话| 零四年属什么| 腺样体肥大有什么症状| 头晕用什么药| cip是什么意思| 嘴角上扬是什么意思| 红枣为什么要去核煮| 子宫肌瘤是什么原因导致的| 肝气郁结是什么意思| 芬必得是什么药| 小朋友喜欢玩什么| 79年属什么| 遗留是什么意思| 心脏支架是什么材料做的| 心烦意乱吃什么药| 女人肾虚吃什么| b细胞淋巴肿瘤是一种什么病| 千金是什么生肖| 梅子色是什么颜色| 星字五行属什么| 胃胀打嗝吃什么药最好| 拆台是什么意思| 什么相关四字成语| 血管瘤是什么| 点灯是什么意思| 50岁属什么| 心脏不好挂什么科| unny是什么牌子| 望子成龙是什么意思| 空调综合征有什么症状| 长卿是什么意思| 英纳格手表什么档次| 11月20号是什么星座| 盆底肌松弛有什么影响| 颈椎病头疼吃什么药| 什么是死缓| 女人吃玛卡有什么好处| 吃了布洛芬不能吃什么| 覆盆子有什么作用| 继往开来是什么意思| 三焦不通吃什么中成药| 手一直脱皮是什么原因| 未免是什么意思| 康复治疗是做什么的| 11号来月经什么时候是排卵期| 12月28日什么星座| 鳌鱼是什么鱼| 生理盐水敷脸有什么效果| 茶叶蛋用什么茶叶最好| 保险子是什么| 口香糖是什么材料做的| 院士是什么级别| 为什么男怕招风耳| 心梗用什么药最好| 芒果有什么好处和坏处| 白带黄绿是什么原因| 是什么标点符号| 男性漏尿是什么原因| 肌醇是什么| 9月份出生的是什么星座| 什么是交际花| hmb是什么意思| 龋病是什么意思| 彪马属于什么档次| 安然无恙的恙是什么意思| 巨蟹座是什么象星座| 为什么喝咖啡会拉肚子| 什么是心律失常| 羊水栓塞是什么原因引起的| 来源朋友验证消息是什么意思| 平权是什么意思| 红配什么颜色最好看| 海藻是什么东西| 作古是什么意思| 为什么会突然得荨麻疹| 华丽的近义词是什么| 林冲到底属什么生肖的| 手淫过度会导致什么| 看月经挂什么科| 吃止疼药有什么副作用| 23数字代表什么意思| 什么叫有机食品| 西瓜和什么相克| 脸浮肿是什么原因引起的| 麻烦是什么意思| 肾积水是什么病严重吗| 1920年属什么生肖| 中国什么时候解放| 老气横秋什么意思| 血虚吃什么食物可以补| 血清碱性磷酸酶高是什么意思| 痔疮吃什么水果好得快| 你喜欢我什么我改| 什么叫阵雨| 271是什么意思| 阅人无数什么意思| 红细胞压积是什么意思| 胎心停了是什么原因引起的| 怀孕需要注意什么| 拉稀是什么原因| 吃什么避孕药可以推迟月经| gr什么意思| 百度
百度 东方网记者将分多路赴现场采访报道,力争在最短时间内为百姓排忧解难。

XQuery API for Java (XQJ) refers to the common Java API for the W3C XQuery 1.0 specification.

XQJ
Developer(s)Java Community Process
Stable release
1.0 / 24?June?2009?(2025-08-14)
TypeData Access API
WebsiteJSR 225: XQuery API for Java
General architecture of how an XQJ driver is used to communicate with an XML Database from Java Applications.

The XQJ API enables Java programmers to execute XQuery against an XML data source (e.g. an XML database) while reducing or eliminating vendor lock in.

The XQJ API provides Java developers with an interface to the XQuery Data Model.[1] Its design is similar to the JDBC API which has a client/server feel and as such lends itself well to Server-based XML Databases and less well to client-side XQuery processors, although the "connection" part is a very minor part of the entire API. Users of the XQJ API can bind Java values to XQuery expressions, preventing code injection attacks.[2] Also, multiple XQuery expressions can be executed as part of an atomic transaction.

History and implementation

edit

The XQuery API for Java was developed at the Java Community Process as JSR 225. It had some big technology backers such as Oracle,[3][4][5][6] IBM,[5][6] BEA Systems,[7] Software AG,[8] Intel, Nokia and DataDirect.[4]

Version 1.0 of the XQuery API for Java Specification was released on June 24, 2009,[9] along with JavaDocs, a reference implementation and a TCK (Technology Compatibility Kit) which implementing vendors must conform to.

The XQJ classes are contained in the Java package javax.xml.xquery

There is no (visible) activity to create a version of XQJ that provides support for XQuery 3.0 or 3.1, for example by providing Java bindings for additions to the data model such as functions, arrays, or maps.

Functionality

edit

XQJ allows multiple implementations to exist and be used by the same application.

XQJ connections support creating and executing XQuery expressions. Expressions may be updating[10] and may include full text searches.[11] XQJ represents XQuery expressions using one of the following classes:

  • XQExpression – the expression is sent to the XQuery processor every time.
  • XQPreparedExpression – the expression is cached and the execution path is pre-determined allowing it to be executed multiple times in an efficient manner.

XQuery expressions return a result sequence of XDM[1] items which in XQJ are represented through the XQResultSequence interface. The programmer can use an XQResultSequence to walk over individual XDM[1] items in the result sequence. Each item in the sequence has XDM[1] type information associated with it, such as its node type e.g. element(), document-node() or an XDM atomic type such as xs:string, xs:integer or xs:dateTime. XDM type information in XQJ can be retrieved via the XQItemType interface.

Atomic XQuery items can be easily cast to Java primitives via XQItemAccessor methods such as getByte() and getFloat(). Also XQuery items and sequences can be serialized to DOM Node, SAX ContentHandler, StAX XMLStreamReader and the generic IO Reader and InputStream classes.

Examples

edit

Basic example

edit

The following example illustrates creating a connection to an XML Database, submitting an XQuery expression, then processing the results in Java. Once all of the results have been processed, the connection is closed to free up all resources associated with it.

// Create a new connection to an XML database
XQConnection conn = vendorDataSource.getConnection("myUser", "myPassword");

XQExpression expr = conn.createExpression(); // Create a reusable XQuery Expression object

XQResultSequence result = expr.executeQuery(
  "for $n in fn:collection('catalog')//item " +
  "return fn:data($n/name)"); // execute an XQuery expression

// Process the result sequence iteratively
while (result.next()) {
    // Print the current item in the sequence
    System.out.println("Product name: " + result.getItemAsString(null));
}

// Free all resources created by the connection
conn.close();

Binding a value to an external variable

edit

The following example illustrates how a Java value can be bound to an external variable in an XQuery expression. Assume that the connection conn already exists:

XQExpression expr = conn.createExpression();

// The XQuery expression to be executed
String es = "declare variable $x as xs:integer external;" +
            " for $n in fn:collection('catalog')//item" +
            " where $n/price <= $x" +
            " return fn:data($n/name)";

// Bind a value (21) to an external variable with the QName x
expr.bindInt(new QName("x"), 21, null);

// Execute the XQuery expression
XQResultSequence result = expr.executeQuery(es);

// Process the result (sequence) iteratively
while (result.next()) {
    // Process the result ...
}

Default data type mapping

edit

Mapping between Java and XQuery data types is largely flexible, however the XQJ 1.0 specification does have default mapping rules mapping data types when they are not specified by the user. These mapping rules bear great similarities to the mapping rules found in JAXB.

The following table illustrates the default mapping rules for when binding Java values to external variables in XQuery expressions.

Default conversion rules when mapping from Java data types to XQuery data types
Java Datatype Default XQuery Data Type(s)
boolean xs:boolean
byte xs:byte
byte[] xs:hexBinary
double xs:double
float xs:float
int xs:int
long xs:long
short xs:short
Boolean xs:boolean
Byte xs:byte
Float xs:float
Double xs:double
Integer xs:int
Long xs:long
Short xs:short
String xs:string
BigDecimal xs:decimal
BigInteger xs:integer
Duration xs:dayTimeDuration if the Duration Object's state is xs:dayTimeDuration
xs:yearMonthDuration if the Duration Object's state is xs:yearMonthDuration
xs:duration if the Duration Object's state is xs:duration
XMLGregorianCalendar xs:date if the XMLGregorianCalendar Object's state is xs:date
xs:dateTime if the XMLGregorianCalendar Object's state is xs:dateTime
xs:gDay if the XMLGregorianCalendar Object's state is xs:gDay
xs:gMonth if the XMLGregorianCalendar Object's state is xs:gMonth
xs:gMonthDay if the XMLGregorianCalendar Object's state is xs:gMonthDay
xs:gYear if the XMLGregorianCalendar Object's state is xs:gYear
xs:gYearMonth if the XMLGregorianCalendar Object's state is xs:gYearMonth
xs:time if the XMLGregorianCalendar Object's state is xs:time
QName xs:QName
Document document-node(element(*, xs:untyped))
DocumentFragment document-node(element(*, xs:untyped))
Element element(*, xs:untyped)
Attr attribute(*, xs:untypedAtomic)
Comment comment()
ProcessingInstruction processing-instruction()
Text text()

Known implementations

edit

Native XML databases

edit

The following is a list of Native XML Databases which are known to have XQuery API for Java implementations.

Relational databases

edit

DataDirect provide XQJ adapters for relational databases, by translating XQuery code into SQL on the fly, then converting SQL result sets into a format suitable for XQJ to process further. The following is a couple of known implementations.

Non-database implementations

edit

The following is a list of non-database XQuery processors which provide an XQuery API for Java interface (typically allowing query against documents parsed from XML in filestore, and held in memory as DOM or similar trees).

License

edit

The specification is marked as "Copyright ? 2003, 2006 - 2009 Oracle. All rights reserved."

The specification contains two separate licenses: a "specification license" and a "reference implementation license".

The specification license allows free copying of the specification provided that copyright notices are retained; it also grants a license to create and distribute an implementation of the specification provided that it fully implements the entire specification, that it does not modify or extend any interfaces, and that it passes the compatibility tests.

This provision has caused some controversy. Firstly, it is not universally accepted that implementing a published specification is something that requires a license (that is, that copyright law would disallow this in the absence of a license).[20][21] Secondly, the license does not meet the criteria to qualify as an open source license (see Open Source Definition), because of the ban on making extensions and modifications. This has led some open source enthusiasts to challenge whether XQJ implementations can ever be considered truly open source.

The license for the reference implementation is a fairly conventional BSD-style open source license.

References

edit
  1. ^ a b c d XQuery 1.0 and XPath 2.0 Data Model (XDM)
  2. ^ Binding Java Variables
  3. ^ Querying XML: XQuery, XPath, and SQL/XML in context - Jim Melton and Stephen Buxton. ISBN?978-1558607118
  4. ^ a b XQJ - XQuery Java API is Completed, Marc Van Cappellen, Zhen Hua Liu, Jim Melton and Maxim Orgiyan Archived 28 July 2012 at the Wayback Machine
  5. ^ a b IBM and Oracle Submit XQuery API for Java (XQJ) Java Specification Request.
  6. ^ a b An Early Look at XQuery API for Java (XQJ) - Andrew Eisenberg, IBM and Jim Melton, Oracle Archived 28 July 2012 at the Wayback Machine
  7. ^ The BEA Streaming XQuery Processor
  8. ^ XQJ Interface for Tamino Native XML Database Archived 30 May 2013 at the Wayback Machine
  9. ^ JSR-000225 XQuery API for Java (Final Release)
  10. ^ XQuery Update Facility
  11. ^ XQuery Full Text
  12. ^ MarkLogic XQJ API
  13. ^ eXist XQJ API
  14. ^ BaseX XQJ API
  15. ^ Sedna XQJ API
  16. ^ Oracle XML DB Support for XQJ
  17. ^ Software AG - Working with the CentraSite XQJ Interface
  18. ^ Zorba 2.5 ships with a long awaited XQJ binding, 14 June 2012
  19. ^ Oracle XML Developer's Kit (XDK) provides a standalone XQuery 1.0 processor for use by Java applications.
  20. ^ "Open Standards" (PDF). Archived from the original (PDF) on 4 March 2016. Retrieved 7 September 2023.
  21. ^ "Groklaw - Oracle v. Google - Understanding the Copyright Issue with API Specifications". www.groklaw.net. Archived from the original on 5 May 2012.
edit
胎盘能治什么病 瞒天过海是什么意思 十点多是什么时辰 t什么意思 吃饭肚子疼是什么原因
关东八大碗都有什么 天丝是什么材质 这是什么虫 女右眉毛跳是什么预兆 无动于衷是什么意思
身上有淤青是什么原因 梦到跟人吵架是什么意思 sparkling是什么意思 牙龈萎缩是什么原因 晚上难入睡是什么原因
阳痿早泄吃什么药最好 根是什么生肖 舌头溃疡吃什么药 脸上爱出汗是什么原因 igg抗体是什么意思
胃胀气有什么症状hcv9jop7ns5r.cn 八一建军节是什么节日hcv8jop4ns5r.cn 五险一金指什么hcv8jop5ns6r.cn 送什么礼物给孩子hcv8jop6ns1r.cn 糜烂性胃炎吃什么药hcv9jop5ns5r.cn
6月20号是什么星座hcv9jop2ns8r.cn 心脏反流吃什么药jasonfriends.com 牙疼可以吃什么药hlguo.com 10月份什么星座hcv8jop6ns7r.cn 为什么起荨麻疹hcv9jop4ns9r.cn
什么品牌的帽子好hcv9jop6ns8r.cn 优五行属性是什么yanzhenzixun.com 阴道炎症是什么症状hcv9jop3ns5r.cn 一丘之貉是什么意思hcv9jop4ns3r.cn 狗为什么会咬人hcv8jop8ns2r.cn
胃炎适合吃什么食物hcv7jop5ns5r.cn 奥美拉唑是什么药hcv8jop3ns1r.cn m代表什么tiangongnft.com 玉髓是什么材质hlguo.com 什么来什么去的四字词语hcv7jop7ns2r.cn
百度