"XPath/XQuery Builder" takes much longer than expected
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
"XPath/XQuery Builder" takes much longer than expected
Post by chrispitude »
Hi everyone,
I noticed that XPath/XQuery Builder takes much longer than I would expect.
As an experiment, I cloned the Oxygen XML user guide repository, opened the userguide.xpr file, opened the UserManual.ditamap map, and compared the following operations being run on the current DITA map scope:
I noticed that XPath/XQuery Builder takes much longer than I would expect.
As an experiment, I cloned the Oxygen XML user guide repository, opened the userguide.xpr file, opened the UserManual.ditamap map, and compared the following operations being run on the current DITA map scope:
- Running an XPath/XQuery Builder query for //prolog took 195 seconds.
- Running a Delete element refactoring operation for prolog took 33 seconds.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: "XPath/XQuery Builder" takes much longer than expected
Hi Chris,
My hunch about this is that the xpath/xquery builder takes the schema (DTD, XML Schema or associated RNG) information into account when executing.
For example you can search for "//@class" and it will find default class attribute values.
The XML refactoring on the other side has a pre-processing stage where it removes the schema information, then processes the resulting XML with XSLT and then adds it back. We do this mostly to avoid the XSLT processor expanding entity references or default attributes. But the side effect is that the transformation cannot match elements based on default attributes.
So I suspect the xpath builder to take more time because for each small DITA topic the schema is quite large, larger than the XML file and needs to be processed to extract attribute values. We have some schema caches that we use when "Validate and check for completeness" is used so I added an internal issue to look into using such caches also for XPath:
EXM-51396 Add schema cache when running XPath on multiple files
Regards,
Radu
My hunch about this is that the xpath/xquery builder takes the schema (DTD, XML Schema or associated RNG) information into account when executing.
For example you can search for "//@class" and it will find default class attribute values.
The XML refactoring on the other side has a pre-processing stage where it removes the schema information, then processes the resulting XML with XSLT and then adds it back. We do this mostly to avoid the XSLT processor expanding entity references or default attributes. But the side effect is that the transformation cannot match elements based on default attributes.
So I suspect the xpath builder to take more time because for each small DITA topic the schema is quite large, larger than the XML file and needs to be processed to extract attribute values. We have some schema caches that we use when "Validate and check for completeness" is used so I added an internal issue to look into using such caches also for XPath:
EXM-51396 Add schema cache when running XPath on multiple files
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: "XPath/XQuery Builder" takes much longer than expected
Post by chrispitude »
Thanks Radu! Now the runtime behavior makes sense.
Conversely, I have sometimes wished that refactoring operations populated DITA @class attributes, to make it easier to write robust refactoring operations that process DITA source (matching base classes to include all specializations, sharing templates between DITA-OT plugins and Oxygen refactoring operations). But I suppose that is a topic for another post!
Conversely, I have sometimes wished that refactoring operations populated DITA @class attributes, to make it easier to write robust refactoring operations that process DITA source (matching base classes to include all specializations, sharing templates between DITA-OT plugins and Oxygen refactoring operations). But I suppose that is a topic for another post!
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: "XPath/XQuery Builder" takes much longer than expected
Hi,
As an update, in the released Oxygen 25.0 version the XPath in files evaluations are done with schema caching and are much faster.
Regards,
Radu
As an update, in the released Oxygen 25.0 version the XPath in files evaluations are done with schema caching and are much faster.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: "XPath/XQuery Builder" takes much longer than expected
Post by chrispitude »
Hi Radu,
You weren't kidding - this feature is enormously faster for us now - thank you!
For the sake of others, is this improvement only for RelaxNG DITA grammars, or does it apply to DTD too?
You weren't kidding - this feature is enormously faster for us now - thank you!
For the sake of others, is this improvement only for RelaxNG DITA grammars, or does it apply to DTD too?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: "XPath/XQuery Builder" takes much longer than expected
Hi Chris,
The speed improvement should work also for DTD based topics and maps. But RNG schemas take the longest to parse so for DTD based schemas the speed improvements may not be as large as the ones for RNG based schemas.
Regards,
Radu
The speed improvement should work also for DTD based topics and maps. But RNG schemas take the longest to parse so for DTD based schemas the speed improvements may not be as large as the ones for RNG based schemas.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service