Rachel,
There’s currently no way to resolve such a query out of MarkLogic’s indexes.
XPath can describe such queries
//*[matches(local-name(.), "foo"]
However, that won’t scale for a large database because that XPath will require
reading the documents themselves, rather than an index, like you’d have with a
word-query, for example. I’m tracking this request and other similar ones, but
I can’t make any promises about if and when we might add this capability to the
database.
In the meantime, I’d suggest you do some sampling. Select a small(ish) number
of documents, randomly or by some other query logic and do some XPath inquiry
on that smaller set.
Something like:
distinct-values(
cts:search(collection(), cts:and-query(()), ("unfiltered","score-random"))[1
to 100]
//*[matches(local-name(.), "Address$")]/xdmp:path(.)
)
where I’m getting the distinct paths of all of the elements whose local names
than end with the string “Address” (e.g. StreetAddress, FullAddress). Again,
this type of query will be expensive on a large set of documents. I’ve limited
my input to the first 100 randomly selected. If you have more smarts about the
query you could do to select the universe of documents, even better
(cts:and-query(()) means select everything).
Justin
On Jan 8, 2014, at 7:23 AM, Rachel Wilson
<[email protected]<mailto:[email protected]>>
wrote:
Is there a way of listing all the paths to wildcarded element name? Either
using a FLOWR expression or cts:search.
i.e. I would like to find all elements with a name that contains a wildcarded
string because I'm unsure of the name of an element or where it is. And the
most useful think I can think of to return would be the path to all elements
(or attributes?) that contain that string.
I found this document<http://developer.marklogic.com/blog/name-is-a-code-smell>
that talks about name() vs local-name() or node-name(), and these return a
QName, and I found xdml:path which would return a path given a node, so what I
think I need is something like node-name but returns the node which I could
pass to xdml:path.
Otherwise I'm aware of term lists and the universal index but I can't find out
how to query them. I guess I'm looking for something akin to the
USER_TAB_COLUMNS dictionary table in Oracle.
Many thanks and happy new year,
Rachel
----------------------------
http://www.bbc.co.uk<http://www.bbc.co.uk/>
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
---------------------
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general