- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个只有一个小的 XML 文件的 BaseX XML 数据库。这些文件基本上由两种结构组成。一个是PlatformCategory
有 46 个实例,另一个 PlatformGenericType
有 213 个实例。PlatformGenericType
引用了 PlatformCategory
在 href
属性。
<PlatformGeneralType id="/plib/platformgeneraltypes/pgt1">
<name>No statement</name>
<enum>NO_STATEMENT</enum>
<isOfPlatformCategory href="/plib/platformcategories/pc1"/>
<readOnly>true</readOnly>
</PlatformGeneralType>
<PlatformCategory id="/plib/platformcategories/pc1">
<name>No statement</name>
<enum>NO_STATEMENT</enum>
<environment>AIR</environment>
<readOnly>true</readOnly>
</PlatformCategory>
//PlatformGeneralType[isOfPlatformCategory/@href=//PlatformCategory[environment="AIR"]/@id]
/PLib/PlatformSpecificTypes/PlatformSpecificType
[isOfPlatformGeneralType/@href=/PLib/PlatformGeneralTypes/PlatformGeneralType
[isOfPlatformCategory/@href=/PLib/PlatformCategories/PlatformCategory
[environment='AIR']/@id]/@id]
PlatformSpecificType
共有 8939 个实例及其结构:
<PlatformSpecificTypes>
<PlatformSpecificType id="/plib/platformspecifictypes/DataShip.3">
<name>Meko 360H2</name>
<lethalityLevel>LOW</lethalityLevel>
<isOfPlatformGeneralType href="/plib/platformgeneraltypes/pgt62"/>
<ownedByCountry href="/plib/countries/10"/>
</PlatformSpecificType>
</PlatformSpecificTypes>
Database Properties
Name: command_plib
Size: 20247 KB
Nodes: 781606
Documents: 1
Binaries: 0
Timestamp: 2015-06-12-10-12-14
Resource Properties
Input Path: /home/sceran/Documents/PLIB/command_plib.xml
Input Size: 21354 KB
Timestamp: 2015-06-11-15-34-07
Encoding: UTF-8
CHOP: true
Indexes
Up-to-date: true
TEXTINDEX: true
ATTRINDEX: true
FTINDEX: false
LANGUAGE: English
STEMMING: true
CASESENS: true
DIACRITICS: false
STOPWORDS:
UPDINDEX: false
AUTOOPTIMIZE: false
MAXCATS: 100
MAXLEN: 96
Compiling:
- rewriting descendant-or-self step(s)
- rewriting descendant-or-self step(s)
- converting descendant::*:PlatformGeneralType[(*:isOfPlatformCategory/@*:href = root()/descendant::*:PlatformCategory[(*:environment = "AIR")]/@*:id)] to child steps
Query:
//PlatformGeneralType[isOfPlatformCategory/@href=//PlatformCategory[environment="AIR"]/@id]
Optimized Query:
db:open-pre("command_plib",0)/*:PLib/*:PlatformGeneralTypes/*:PlatformGeneralType[(*:isOfPlatformCategory/@*:href = root()/descendant::*:PlatformCategory[(*:environment = "AIR")]/@*:id)]
Result:
- Hit(s): 55 Items
- Updated: 0 Items
- Printed: 12776 Bytes
- Read Locking: local [command_plib]
- Write Locking: none
Timing:
- Parsing: 0.55 ms
- Compiling: 0.3 ms
- Evaluating: 5786.29 ms
- Printing: 1.0 ms
- Total Time: 5788.15 ms
Query plan:
<QueryPlan compiled="true">
<IterPath>
<DBNode name="command_plib" pre="0"/>
<IterStep axis="child" test="*:PLib"/>
<IterStep axis="child" test="*:PlatformGeneralTypes"/>
<IterStep axis="child" test="*:PlatformGeneralType">
<CmpG op="=">
<CachedPath>
<IterStep axis="child" test="*:isOfPlatformCategory"/>
<IterStep axis="attribute" test="*:href"/>
</CachedPath>
<IterPath>
<Root/>
<IterStep axis="descendant" test="*:PlatformCategory">
<CmpG op="=">
<CachedPath>
<IterStep axis="child" test="*:environment"/>
</CachedPath>
<Str value="AIR" type="xs:string"/>
</CmpG>
</IterStep>
<IterStep axis="attribute" test="*:id"/>
</IterPath>
</CmpG>
</IterStep>
</IterPath>
</QueryPlan>
<PlatformSpecificTypes>
<PlatformSpecificType id="/plib/platformspecifictypes/DataShip.3">
<name>Meko 360H2</name>
<lethalityLevel>LOW</lethalityLevel>
**<isOfPlatformGeneralType>/plib/platformgeneraltypes/pgt62 </isOfPlatformGeneralType>**
<ownedByCountry href="/plib/countries/10"/>
</PlatformSpecificType>
</PlatformSpecificTypes>
/root/PlSpTys/PlSpTy[isOfPlGeTy/@href=/root/PlGeTys/PlGeTy[isOfPlCt/@href=/root/PlCts/PlCt[environment='AIR']/@id]/@id]
Query:
/root/PlSpTys/PlSpTy[isOfPlGeTy/@href=/root/PlGeTys/PlGeTy[isOfPlCt/@href=/root/PlCts/PlCt[environment='AIR']/@id]/@id]
Result:
- Hit(s): 3642 Items
- Updated: 0 Items
- Printed: 257 KB
- Read Locking: local [Output6]
- Write Locking: none
Timing:
- Parsing: 0.66 ms
- Compiling: 0.34 ms
- Evaluating: 28398.32 ms
- Printing: 4.63 ms
- Total Time: 28403.97 ms
Query plan:
<QueryPlan compiled="true">
<IterPath>
<DBNode name="Output6" pre="0"/>
<IterStep axis="child" test="*:root"/>
<IterStep axis="child" test="*:PlSpTys"/>
<IterStep axis="child" test="*:PlSpTy">
<CmpG op="=">
<CachedPath>
<IterStep axis="child" test="*:isOfPlGeTy"/>
<IterStep axis="attribute" test="*:href"/>
</CachedPath>
<IterPath>
<Root/>
<IterStep axis="child" test="*:root"/>
<IterStep axis="child" test="*:PlGeTys"/>
<IterStep axis="child" test="*:PlGeTy">
<CmpG op="=">
<CachedPath>
<IterStep axis="child" test="*:isOfPlCt"/>
<IterStep axis="attribute" test="*:href"/>
</CachedPath>
<IterPath>
<Root/>
<IterStep axis="child" test="*:root"/>
<IterStep axis="child" test="*:PlCts"/>
<IterStep axis="child" test="*:PlCt">
<CmpG op="=">
<CachedPath>
<IterStep axis="child" test="*:environment"/>
</CachedPath>
<Str value="AIR" type="xs:string"/>
</CmpG>
</IterStep>
<IterStep axis="attribute" test="*:id"/>
</IterPath>
</CmpG>
</IterStep>
<IterStep axis="attribute" test="*:id"/>
</IterPath>
</CmpG>
</IterStep>
</IterPath>
</QueryPlan>
最佳答案
BaseX 似乎没有意识到它应该用静态结果预处理“内部”部分,因此评估成本在 O(n^2)
左右。而不是 O(n)
.
重新格式化您的查询(在我的机器上大约需要 30 秒)以更好地理解它显示第一个谓词内的比较的整个右侧是静态的,不依赖于 PlSpTy
目前分析的元素:
/root/PlSpTys/PlSpTy[
isOfPlGeTy/@href=/root/PlGeTys/PlGeTy[
isOfPlCt/@href=/root/PlCts/PlCt[
environment='AIR'
]/@id
]/@id
]
PlSpTy
元素 (
count(/root/PlSpTys/PlSpTy)
) 显示接近 8939 个这样的元素,因此内部部件的评估成本约为
8939*9ms ~= 80s
-- 某些东西肯定已经被优化掉了,但不是所有的东西。
let $compare :=
/root/PlGeTys/PlGeTy[
isOfPlCt/@href=/root/PlCts/PlCt[
environment='AIR'
]/@id
]/@id
return
/root/PlSpTys/PlSpTy[
isOfPlGeTy/@href=$compare
]
关于basex - 优化 BaseX 中的慢速 XQuery 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30798336/
我有一个只有一个小的 XML 文件的 BaseX XML 数据库。这些文件基本上由两种结构组成。一个是PlatformCategory有 46 个实例,另一个 PlatformGenericType有
似乎 BaseX gui 只适用于本地数据库。有什么方法可以使用 BaseX gui 连接和管理远程 BaseX 服务器?如果没有,是否有任何第 3 方解决方案? 提前谢谢你。 最佳答案 我终于在Ba
我已经通过文档和 SO 检查了有关 BaseX 中 SET WRITEBACK TRUE 的信息,因为它写入数据更新的性质(根据文档)。 这是我遇到的问题:在一台计算机 (Ubuntu 15.10)
我有这个简单的 XML 文件: 557 Fleece Pullover navy black 563 Floppy Sun Hat
我使用以下docker compose文件启动basexhttp服务器和dba: 版本:“3” 服务: basexhttp: 图片:basex / basexhttp 端口: -“1984:1984”
我使用的是官方文档:http://docs.basex.org/wiki/Commands#String_Syntax ,而且我一直无法找到逻辑运算符的列表。我希望能够查询 text contains
目前,我是一个研究小组的实习生,该小组可以搜索大量文本(语料库)。不仅可以搜索文字字符串,更重要的是,还可以查找与给定输入类似的语法依赖结构,而无需精通任何编程语言或语料库注释风格。很明显,这个工具是
从理论角度来看,如何在 Java 中运行 BaseX 数据库的命令(如 http://docs.basex.org/wiki/Commands 中描述的命令)。是否存在一些工作到比 XPath 更高的
我在 Linux 机器上安装了 basex。安装运行良好,我能够编辑 .basex 文件以将任何执行指向主数据库,并且可以从任何地方运行客户端并连接。 我也有运行 basex war 包的 jetty
我是一名计算机科学专业的学生,我们必须在我们的一门类(class)中使用 BaseX(一种纯 Java OSS XML 数据库)。在浏览代码时,我发现了以下代码: /** * Retu
下面是 XML 文件 - Introduction 1 History of Internet
我编写了一个 XQuery 表达式,其结果约为 50MB,需要几个小时才能计算。我在 BaseX GUI 中执行它,但这有点不方便:它将结果裁剪到结果窗口,然后我必须保存它。此时,BaseX 变得无响
我对使用 BaseX api 进行开发还很陌生,并且我一直在使用其中一种方法时遇到一些麻烦。我创建并打开了一个数据库,但是当我尝试使用 Add 方法时,它抛出异常。请参阅this page以 Base
使用 BaseX 程序,我能够使用 XPath 和 XQuery 来查询位于我的主目录中的 XML 文档,但是我在 XSLT 中执行相同操作时遇到了问题。 我查询的文档是 BookstoreQ.xml
这是一个非常基本的问题,但我似乎找不到答案。我刚刚安装了 BaseX(Win7 PRO/64 位上的 V.7.8.1)并让它通过他们的 GUI 成功运行。我现在正尝试通过他们的 JAVA 示例(来自
我正在尝试使用 XPath 在 instance 中导航。我在下面提供了 original 的摘录实例: 0000874214 2
是否可以将一百万条记录(xml 文件)存储到 Basex 数据库中? for(int j=1;j<1000000;j++) { String id=String.valueOf(j);
我正在努力开始使用 BaseX RESTXQ API。 我已经下载并安装了适用于 Windows 的最新版本的 BaseX。我通过单击 BaseX 安装添加到 Windows 开始菜单的“BaseX
使用org.json,最重要的是,使用JSONArray而不是JSONObject,成功地seemingly at least ,通过 Twitter4J 获取 XML 输出。然而,它shows如:
我正在尝试使用 Java BaseX XQJ API 将数据插入 到 XML 文件中。 代码如下(忽略导入): public class BaseXTest { public static void
我是一名优秀的程序员,十分优秀!