1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<?vsp
--
-- $Id: faq.vsp,v 1.2 2006/08/15 19:30:33 source Exp $
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2006 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
?>
<HTML>
<BODY TEXT="#000000" LINK="#0000CC" VISITED="#3300CC" BGCOLOR="#EEEEEE" TOPMARGIN=0>
<P><B>Use case 1.6.4.1 have odd results format. Why are the two results separated that way?</B><BR>
It is not a bug, but feature :)
For some sorts of queries, it is possible to build partial results without waiting for the end of processing.
The most common sample is XPATH expression compiled as XQuery expression.
For given XPATH Virtuoso can usually iterate a sequence of matched nodes of the document, not the whole result at once.
E.g. if application knows that there's only one <abstract> tag inside <chapter> tag
then it may fetch the first result of <FONT SIZE="+1" COLOR="#006600"><CODE>$doc/chapter//abstract</CODE></FONT> without the redundant search through the rest of the entity.
Exactly the same functionality is provided for XQuery.
Application may ask either for n-th answer of the sequence or for the whole sequence at once.
To get the whole sequence as one answer, use list() XPATH function.
</P>
<P><B>Some output XMLs contain large number of identical namespace declarations.
Is it possible to make them more readable?</B><BR>
Sometimes it may be done by adding declarations of most "popular"
namespaces into tag of the outermost element of the resulting XML,
but there are no universal methods. Partially, it will not work if
document() XPATH function is used to build some parts of the result.
In real applications, Virtuoso's built-in XSLT processor may be used
to make output XML more readable.
</P>
<P><B>In Virtuoso, XPATH expressions may contain free-text search criteria.
Is this functionality available in XQuery?</B><BR>
Yes, because any free-text search operations may be performed
in PL/SQL procedures called from XQuery.
From other side, XQuery may be called after xcontains() in SELECT statement,
e.g.
<BLOCKQUOTE><FONT SIZE="+1" COLOR="#006600"><CODE>
select<BR>
LIBRARY.ARTICLE_ID as HIT_ID,<BR>
xquery_eval('<hit>{title,authors}</hit>', FREETEXT_HIT) as HIT_DATA<BR>
from LIBRARY<BR>
where<BR>
xcontains(<BR>
'article[text-contains(abstract,<BR>
''("search" or "sort*") and not "bubble* sort*")'')]',<BR>
ARTICLES.ARTICLE_XML,<BR>
0,<BR>
FREETEXT_HIT<BR>
)<BR>
and<BR>
ARTICLES.ARTICLE_PUBLISHING_DATE >= '2000-01-01'</CODE></FONT></BLOCKQUOTE>
will return title information about all fresh articles related to searching and sorting
except those related to bubble sorting.
</P>
<P><B>Some XPATH functions must process the first node of given node-set,
and XPATH standard says that "first" means "first in document order".
Why are they process the "first found node" in Virtuoso's XQuery?</B><BR>
The old XPATH rule is senseless if nodes of the node-set are retrieved from more than one document
and/or are created inside the query.
Moreover, sequence of XQuery values may be a mix of nodes and values of other types.
For compartibility, XQuery processor tries to follow old rule while it it cheap in terms of speed and consumed memory;
e.g. it matches old rules for all use cases of this demo.
In real applications, filtering may be
improved in the query in order to get only one node but not the redundant
node-set.
</P>
</BODY>
</HTML>
|