[MarkLogic Dev General] short question about result of sem:sparql-values

2018-02-20 Thread Erik Zander
Hi,

I have what I feel should be a simple question but I yet to understand how it's 
done.

When calling sem:sparql-values how do I get the result?
In the
documentation it says it's a sequence 
http://docs.marklogic.com/guide/semantics/semantic-searches - 
id_90139 
but that is as I understand it a sequence of sem:binding
Output of xdmp:describe

sem:binding(http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:json="http://marklogic.com/xdmp/json;>)

Raw Output

[{"notEmpty":"","label":"\"Friedrich 
Hegel\"@sv"}]

In this case I just want to get the value Friedrich Hegel.
Doing sem:sparql-values($sparql,$bindings)/label doesn't work as it says not a 
node

Any pointers on how I should go about would be welcome.

Regards
Erik

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] question about transactions

2018-01-25 Thread Erik Zander
Thanks David and Geert,

I might have made a confusion as to why I wanted to do both insert and read.
Also Geerts question sparked me to have another go at looking at the 
documentation and to great benefit.

My goal was to have a function to call a sparql endpoint for a specific 
question.
To ease the load on the endpoint I wanted to store the rdf in Markolgic to 
cache it.

Now I ended up doing pretty much the same but using an in-memory-store.

So code ended up like.

declare function wdCon:getKeyDataforQid($QId as xs:string, $lang as xs:string?) 
as node()*

{
//Variables etc //
let $data := 
sem:query-results-serialize(sem:sparql($sparqlML))//spql:results/spql:result/spql:binding[@name
 = "label"]/spql:literal/text()
return
if ($data) then
$data
else
let $sparqlWD :=
"
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
describe  ?label WHERE {
   " || $QId || "  rdfs:label ?label
   FILTER (langMatches( lang(?label), '" || $qlang || "' ) )
}"
let $wDataRdf := wdCon:queryWithSparql($sparqlWD)
let $wDSemTrip := sem:rdf-parse($wDataRdf,("rdfxml", 
"graph=http://www.wikidata.org;))
let $_rdf_insert := 
sem:rdf-insert($wDSemTrip,(),$conf:defaultPermissions  )
let $semStore := sem:in-memory-store($wDSemTrip)


return 
sem:query-results-serialize(sem:sparql($sparqlML,(),(),$semStore) 
)//spql:results/spql:result/spql:binding[@name = "label"]/spql:literal/text()
};


Regards and thanks
Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Geert Josten
Skickat: den 25 januari 2018 06:50
Till: MarkLogic Developer Discussion <general@developer.marklogic.com>
Ämne: Re: [MarkLogic Dev General] question about transactions

The outer query runs in query mode, so runs against the timestamp of initial 
invocation, causing it to never see the result of sem:rdf-insert. You'd have to 
put the sem:sparql in an xdmp:eval with different-transaction as well.

I also wonder though: what are you trying to do, why trying to squeeze insert 
and read in one request?

Cheers,
Geert

From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of David Ennis 
<david.en...@marklogic.com<mailto:david.en...@marklogic.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Wednesday, January 24, 2018 at 7:34 PM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: Re: [MarkLogic Dev General] question about transactions

Please look up the options for xdmp:eval and note the following options 
explained there:
- transaction-mode
- isolation

Then change your eval to have the following options:
- transaction-mode=update-auto-commit
- isolation = different transaction

Then move the sem:sparql statement below the eval in your main code.

What are you doing here?

You are telling the insert to run as a separate transaction and auto-commit. 
This makes the triples available immediately after the eval is done. Therefore, 
you should run the select in the main code and not the isolated transaction.

Careful with the use of different transactions via eval and invoke. The wrong 
combination can get you into a deadlock.

Regards,
David Ennis

--


From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of Erik Zander 
<erik.zan...@studentlitteratur.se<mailto:erik.zan...@studentlitteratur.se>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Wednesday, January 24, 2018 at 5:35 PM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] question about transactions

Hi All,

I have a question about I think transactions.

I want to insert some rdf and then query the database, and I want to do this in 
a function so I can call the function and depending on if I have the data in 
Marklogic or not get the data as rdf and insert it.

But my problem is that the following code only returns result second time I 
call it.
I'm thankful for pointers here
Regards
Erik
Code below
==

xquery version "1.0-ml"encoding "utf-8";


import module namespace sem="http://marklogic.com/semantics;
  at"/MarkLogic/semantics.xqy";
declare namespace 
rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns>";

let $wDataRdf:=
http://www.w3.org/1999/02/2

[MarkLogic Dev General] question about transactions

2018-01-24 Thread Erik Zander
Hi All,

I have a question about I think transactions.

I want to insert some rdf and then query the database, and I want to do this in 
a function so I can call the function and depending on if I have the data in 
Marklogic or not get the data as rdf and insert it.

But my problem is that the following code only returns result second time I 
call it.
I’m thankful for pointers here
Regards
Erik
Code below
==

xquery version "1.0-ml" encoding "utf-8";


import module namespace sem = "http://marklogic.com/semantics;
  at "/MarkLogic/semantics.xqy";
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;;

let $wDataRdf :=
http://www.w3.org/1999/02/22-rdf-syntax-ns#;
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#;

  xmlns:wikibase="http://wikiba.se/ontology#;
  xmlns:wd="http://www.wikidata.org/entity/;
  >
http://www.wikidata.org/entity/Q925hhq;>
mup



let $insert :=  xdmp:eval(
'
import module namespace sem = "http://marklogic.com/semantics;
  at "/MarkLogic/semantics.xqy";
declare variable $wDataRdf as node() external;
sem:rdf-insert(sem:rdf-parse($wDataRdf,("rdfxml", 
"graph=http://www.wikidata.org;)))'
,(xs:QName("wDataRdf"), $wDataRdf)
)
return sem:sparql('
PREFIX wd: 
PREFIX rdfs: 
SELECT ?label WHERE {
   wd:Q925hhq  rdfs:label ?label
   FILTER (langMatches( lang(?label), "SV" ) )
}'
)



___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Cross-document links via IDs

2017-06-08 Thread Erik Zander
Hi Luke,

Here’s some information to get you started. There’s a multitude of ways to link 
documents together in Marklogic, some of them are:
*using a separate rdf structure
–pros: easily extendable, can link to others resources
–cons: it’s a separate structure you will need to have your code query for 
those relations.
*using embedded rdf
–pros: more connected to the document
–cons: you have rdf in the document that your standard may or may not allow
*Using an envelope structure, enveloping your xml as part of a little bigger 
xml document in which you put all required metadata including parent child 
document relations (xlink).
-pros: metadata connected to each document
 -cons: using the xml as a whole always involves 
grabbing the content within the document.
*Adding the link information to the document, preferably using the xlink 
namespace. Marklogic have functions for expanding xlinks ( 
https://docs.marklogic.com/xinc )
 -pros: all links in the document itself where they 
logically links to the other resource, easy to do node expansion if you want 
the whole document with children.
 -cons: maintainability can be harder as you can 
have links scattered around your content. You have to modify your content.
For more information on some of the different ways have a look at 
http://www.marklogic.com/resources/slides-moving-from-relational-modeling-to-xml-and-marklogic-data-models/resource_download/recordings/

From you question it sounds like your into the xlink idea.

To insert all links during ingestion with mlcp you should be able to write a 
transform that extends mlcp (see 
https://docs.marklogic.com/guide/mlcp/import#id_82518  ) in which you can add 
the id and relations. The question is if you have that data available in that 
stage (in the document or in a separate file uploaded before the actual 
ingestion).

Another way is to create the xlinks before ingestion, using any method you like.

I hope this was of some use ☺
Regards
Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Lucas Davenport
Skickat: den 5 juni 2017 16:16
Till: general@developer.marklogic.com
Ämne: [MarkLogic Dev General] Cross-document links via IDs

We are exploring the options of incorporating ML as our document storage engine 
for our application. Currently our data is stored in an RDBMS, but we can 
easily export the data in XML format. One issue that we're currently having 
while developing the model is the need to keep some relational integrity 
between some documents (parent-child). I know from the limited research I've 
done that cross-document links are available with ML. However, I do not know if 
it is possible to create auto-generated ids in ML for such documents. Can ML 
create/generate id values for parent/child documents on-the-fly during 
ingestion (we'll likely use mlcp)? If so, can anyone point me in the right 
direction for more info on how these are created and/or the configuration 
required.

Thanks in advance!

Best Regards,
Luke

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] question about permissions

2017-04-03 Thread Erik Zander
Hi Gary,

Yes that was the issue, and I should know this…
Thanks for the help.

Regards
Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Gary Vidal
Skickat: den 31 mars 2017 13:38
Till: general@developer.marklogic.com
Ämne: Re: [MarkLogic Dev General] question about permissions

You have no document permissions. When you inserted the content you probably 
used the admin role which means all docs in database have no permissions.  YOu 
can confirm this by just running xdmp:document-get-permissions($uri) on any 
document.

To solve this problem always load your content with permissions explicitly. If 
you dont have that luxury to reload you can use the task-server to spawn 
functions to add them.  Make sure you have enough task queue depth on task 
server.


let $perms := (
  xdmp:permission("role","read"),
  ...
)
return
 for $uri in cts:uris()
 return xdmp:spawn-function(function(){
xdmp:document-set-permissions($uri,$perms)
},
 
   update-auto-commit
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] question about permissions

2017-03-31 Thread Erik Zander
Hi all I have the following function and I encounter a problem with permissions.

If I grant the user default user of the http server the admin role I get 
results but without the admin role the function returns no results.

I would be happy to have some pointers of what permissions the user needs to be 
able to complete the request.

declare function meta:get-diffscore($bookid as xs:string) as xs:string
{

let $bookiri := concat("metaLit:",$bookid)
let $evalOptions := 
different-transaction
true
{xdmp:database($c:IMAGE_DATABASE_NAME)}

let $evalString := concat(
' import module namespace sem = "http://marklogic.com/semantics;
at "/MarkLogic/semantics.xqy";
sem:sparql("
PREFIX metaLit: <',$c:semLiteraturePrefix,'>
PREFIX meta: <',$c:semMetaPrefix,'>

SELECT ?diffScore
WHERE
{ ',$bookiri,' meta:RTdiffScore ?diffScore}
")
')


return 
(sem:query-results-serialize(xdmp:eval($evalString,(),$evalOptions))//sparqlRes:binding[@name="diffScore"]//text(),"")[1]

};


Regards
Erik Zander
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] General Digest, Vol 153, Issue 4

2017-03-03 Thread Erik Zander
Hi Yogesh

Just to rule this out, do you use different types of authentication on your 
remote server and your local machine.

Namely do you use basic on your local machine and higher on the server. If so 
have you changed the windows (assuming you run it on windows) registry to allow 
basic authentications?

Regards
Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Yogesh Kumar
Skickat: den 3 mars 2017 09:43
Till: general@developer.marklogic.com
Ämne: Re: [MarkLogic Dev General] General Digest, Vol 153, Issue 4

Hi Geert,

As I wrote in my previous mail I have MarkLogic installed in my desktop 
computer. In that I have created a WebDAV server with 8777 port number.
It is created successfully and attached to my module database.
To access files in my module database by file explorer, I am trying to add 
network location in my desktop with my WebDAV details which is giving me the 
error message "The folder you entered does not appear to be valid. Please 
choose another."

Note: I can able to add network location of WebDAV server which is created in 
remotely installed MarkLogic. I am facing this issue with MarkLogic server 
installed in my machine.


Thanks,
Yogesh

On 03-Mar-2017 1:30 AM, 
>
 wrote:
Send General mailing list submissions to
general@developer.marklogic.com

To subscribe or unsubscribe via the World Wide Web, visit
http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to

general-requ...@developer.marklogic.com

You can reach the person managing the list at

general-ow...@developer.marklogic.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of General digest..."


Today's Topics:

   1. Unable to add network location of web dev server (Yogesh Kumar)
   2. Re: Unable to add network location of web dev server
  (Geert Josten)


--

Message: 1
Date: Thu, 2 Mar 2017 14:21:31 +0530
From: Yogesh Kumar >
Subject: [MarkLogic Dev General] Unable to add network location of web
dev server
To: general@developer.marklogic.com
Message-ID:

>
Content-Type: text/plain; charset="utf-8"

Hi Team,

I have ML instance in my local machine. I am trying to add a network
location for a web dev which I have created in same MarkLogic server.

While doing I am getting the following error.
"The folder you entered does not appear to be valid. Please choose another".

I have entered the path as
"http://localhost:8777;.


Thanks,
Yogesh
-- next part --
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20170302/bd53d465/attachment-0001.html

--

Message: 2
Date: Thu, 2 Mar 2017 09:25:02 +
From: Geert Josten 
>
Subject: Re: [MarkLogic Dev General] Unable to add network location of
web dev server
To: MarkLogic Developer Discussion 
>
Message-ID: 
>
Content-Type: text/plain; charset="us-ascii"

Hi Yogesh,

Can you provide more detail?

Cheers,
Geert

From: 
>>
 on behalf of Yogesh Kumar 
>>
Reply-To: MarkLogic Developer Discussion 
>>
Date: Thursday, March 2, 2017 at 9:51 AM
To: 
"general@developer.marklogic.com>"
 
>>
Subject: [MarkLogic Dev General] Unable to add network location of web dev 
server

Hi Team,

I have ML instance in my local machine. I am trying to add a network location 
for a web dev which I have created in same MarkLogic server.

While doing I am 

Re: [MarkLogic Dev General] passing a document-node into an eval/invoke

2017-02-15 Thread Erik Zander
Hi Florent,

Thank you!

Using map:entry solved it and goes with my intentions.
Also thanks for the great explanation it’s obvious why map:map doesn’t work 
when its explained well.

Regards
Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Florent Georges
Skickat: den 15 februari 2017 12:18
Till: MarkLogic Developer Discussion <general@developer.marklogic.com>
Ämne: Re: [MarkLogic Dev General] passing a document-node into an eval/invoke

Hi,
Short answer: what you want is to use map:entry() instead of
map:map().  The following returns true (that is, it stores a document
node as the value of the key "key" in the map):

let $doc := document {  }
let $map := map:entry('key', $doc)
return
   map:get($map, 'key') instance of document-node()

So what is the difference with the following, which stores an element
node instead?

let $doc := document {  }
let $map := map:map(
  
 
key
{ $doc }
 
  )
return
   map:get($map, 'key') instance of element()

The difference is that the above first copy the document node to an
XML tree.  A document node added to an element is just "ignored", its
children get copied directly, as per the XDM recommendation.  This XML
tree is used as an XML representation of a map, and "deserialized".
What is in the element map:value *IS* an element node at this point,
so ends up as such in the map.

This might be more clear if we get rid of all the map machinery:

let $doc  := document {  }
let $elem := { $doc }
return
   $elem/node() instance of element()

The value of $elem in this last code is the following (which makes
sense, right?, what else could it be?):


   


Regards,

--
Florent Georges
H2O Consulting
http://h2o.consulting/

On 15 February 2017 at 11:37, Erik Zander wrote:
Hi All,

I did iron out why I got errors, now I could use some help finding the best 
solution to it.

The error is that I have code like

……

let $evalParams := map:map(


document
{$doc}

)
let $resultDocument := xdmp:eval($transformCode, $evalParams)

where in the $transform code it checks for a document-node
declare variable $document as document-node() external;

To my understanding this has to do with the map:map structure.

But is there a good way of going around it. I could use xdmp:unqote but it 
feels a bit messy. I could also put into the database but doing document 
inserts and deletions just for that feels like a bit much overhead.

Any thoughts on this is greatly appreciated.

Regards
Erik

___
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] passing a document-node into an eval/invoke

2017-02-15 Thread Erik Zander
Hi All,

I did iron out why I got errors, now I could use some help finding the best 
solution to it.

The error is that I have code like

..

let $evalParams := map:map(


document
{$doc}

)
let $resultDocument := xdmp:eval($transformCode, $evalParams)

where in the $transform code it checks for a document-node
declare variable $document as document-node() external;

To my understanding this has to do with the map:map structure.

But is there a good way of going around it. I could use xdmp:unqote but it 
feels a bit messy. I could also put into the database but doing document 
inserts and deletions just for that feels like a bit much overhead.

Any thoughts on this is greatly appreciated.

Regards
Erik
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] xdmp:get-request-body(); as document-node

2017-02-15 Thread Erik Zander
Hi Gert,

Thanks for confirming I wasn't way of :)
The body isn't empty but it doesn't matter as the error seams to be elsewhere 
anyway.

Regards Erik

Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För Geert Josten
Skickat: den 15 februari 2017 10:07
Till: MarkLogic Developer Discussion <general@developer.marklogic.com>
Ämne: Re: [MarkLogic Dev General] xdmp:get-request-body(); as document-node

Hi Erik,

I think it is supposed to return a document-node, and if it doesn't perhaps the 
body is empty. You can find some usage notes here:

http://docs.marklogic.com/xdmp:get-request-body

And yes, normally `document { $body }` should do the trick, but if $body is 
empty, you end up with an empty doc node..

Cheers,
Geert

From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of Erik Zander 
<erik.zan...@studentlitteratur.se<mailto:erik.zan...@studentlitteratur.se>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Wednesday, February 15, 2017 at 9:54 AM
To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] xdmp:get-request-body(); as document-node

Hi All,

I hope you can help me here as my memory won't cooperate :)

I'm using
declare variable $xmlBody := xdmp:get-request-body();<= input here is a 
post with content-type application/xml

and later in the code I check that it's a document node but that check fails

How can I convert the $xmlBody into a document node? Document{$xmlbody} didn't 
do the trick.

Regards
Erik
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] xdmp:get-request-body(); as document-node

2017-02-15 Thread Erik Zander
Hi All,

I hope you can help me here as my memory won't cooperate :)

I'm using
declare variable $xmlBody := xdmp:get-request-body();<= input here is a 
post with content-type application/xml

and later in the code I check that it's a document node but that check fails

How can I convert the $xmlBody into a document node? Document{$xmlbody} didn't 
do the trick.

Regards
Erik
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Query performance in MarkLogic

2015-02-16 Thread Erik Zander
Hi Srinivas,

Well yes, at some point you will need to access both documents if you want some 
combination of them but this could be done with one query by using cts:and-query
A good place for more on search is http://docs.marklogic.com/guide/search-dev 
and more specifically 
http://docs.marklogic.com/guide/search-dev/structured-query for an example of 
an and query.

Regards
Erik

Från: Srinivas [mailto:srini...@nervecentrex.com]
Skickat: den 16 februari 2015 10:31
Till: 'MarkLogic Developer Discussion'
Ämne: Re: [MarkLogic Dev General] Query performance in MarkLogic

Hi Eric,

Thank you for the suggestion but I wonder, do I need to make 2 queries to get 
the complete data of user?

First query to get the data from user.xml and then query group.xml to get the 
group name. If am wrong somewhere excuse me. Am new to MarkLogic.

Thanks  Regards,
Srinivas | Sr CakePHP Programmer
+91 - 9538025790 | srini...@nervecentrex.commailto:srini...@nervecentrex.com

nerve centrex software (India) pvt. Ltd.
122 soudhamini 3rd main gruhalakshmi layout II stage
Kamalanagar Bangalore 560079 Karnataka India

[cid:image002.png@01CF74D9.64936420]


Disclaimer: This communication is for informational purposes only. It is not 
intended as an offer or solicitation for the purchase or sale of any financial 
instrument or as an official confirmation of any transaction. All market 
prices, data and other information are not warranted as to completeness or 
accuracy and are subject to change without notice.  Any comments or statements 
made herein do not necessarily reflect those of Nerve Centrex Software (India) 
Pvt. Ltd., its subsidiaries and affiliates.

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify Nerve Centrex 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. Nerve Centrex 
Software (India) Pvt. Ltd., its subsidiaries and affiliates therefore does not 
accept liability for any errors or omissions in the contents of this message, 
which arise as a result of e-mail transmission. Although this transmission and 
any attachments are believed to be free of any virus or other defect that might 
affect any computer system into which it is received and opened, it is the 
responsibility of the recipient to ensure that it is virus free and no 
responsibility is accepted by Nerve Centrex Software (India) Pvt. Ltd., its 
subsidiaries and affiliates, as applicable, for any loss or damage arising in 
any way from its use.

From: 
general-boun...@developer.marklogic.commailto:general-boun...@developer.marklogic.com
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Monday, February 16, 2015 2:33 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Query performance in MarkLogic

Hi Srinivas,

I was wondering why you doesn't use the xml:id attribute like this
/User1.xml



User xml:id=1



  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group xml:id=10
NameAdmin/Name
/Group

With this structure you could use an element attribute query (to get good 
performance you would need to make sure the xml:id attribute is indexed)
cts:search(//module,
cts:element-attribute-value-query(
  xs:QName(Group),

  xs:QName(xml:id),
  $group-id-referenced))

About performance in general if you make use of indexes in you searches you 
geet good performance.

Regards
Erik
Från: Srinivas [mailto:srini...@nervecentrex.com]
Skickat: den 16 februari 2015 06:54
Till: 'MarkLogic Developer Discussion'
Ämne: [MarkLogic Dev General] Query performance in MarkLogic

Hi All,

I was trying to build a database in MarkLogic with following document format.

/User1.xml



User

  Id1/Id

  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group
Id10/Id
NameAdmin/Name
/Group

If I want to get the group name for the user id 1, how could I achieve it ? 
Shall I use qbe query to find the name or any other mechanism is there to 
connect both documents?

And if I use multiple queries, am I losing the performance here?


Thanks  Regards,
Srinivas | Sr CakePHP Programmer
+91 - 9538025790 | srini...@nervecentrex.commailto:srini...@nervecentrex.com

nerve centrex software (India) pvt. Ltd.
122 soudhamini 3rd main gruhalakshmi layout II stage
Kamalanagar Bangalore 560079 Karnataka India

[cid:image002.png@01CF74D9.64936420]


Disclaimer: This communication is for informational purposes only. It is not 
intended as an offer or solicitation for the purchase or sale of any financial 
instrument or as an official

Re: [MarkLogic Dev General] Query performance in MarkLogic

2015-02-16 Thread Erik Zander
Hi Srinivas,

I was wondering why you doesn't use the xml:id attribute like this
/User1.xml



User xml:id=1



  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group xml:id=10
NameAdmin/Name
/Group

With this structure you could use an element attribute query (to get good 
performance you would need to make sure the xml:id attribute is indexed)
cts:search(//module,
cts:element-attribute-value-query(
  xs:QName(Group),

  xs:QName(xml:id),
  $group-id-referenced))

About performance in general if you make use of indexes in you searches you 
geet good performance.

Regards
Erik
Från: Srinivas [mailto:srini...@nervecentrex.com]
Skickat: den 16 februari 2015 06:54
Till: 'MarkLogic Developer Discussion'
Ämne: [MarkLogic Dev General] Query performance in MarkLogic

Hi All,

I was trying to build a database in MarkLogic with following document format.

/User1.xml



User

  Id1/Id

  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group
Id10/Id
NameAdmin/Name
/Group

If I want to get the group name for the user id 1, how could I achieve it ? 
Shall I use qbe query to find the name or any other mechanism is there to 
connect both documents?

And if I use multiple queries, am I losing the performance here?


Thanks  Regards,
Srinivas | Sr CakePHP Programmer
+91 - 9538025790 | srini...@nervecentrex.commailto:srini...@nervecentrex.com

nerve centrex software (India) pvt. Ltd.
122 soudhamini 3rd main gruhalakshmi layout II stage
Kamalanagar Bangalore 560079 Karnataka India

[cid:image002.png@01CF74D9.64936420]


Disclaimer: This communication is for informational purposes only. It is not 
intended as an offer or solicitation for the purchase or sale of any financial 
instrument or as an official confirmation of any transaction. All market 
prices, data and other information are not warranted as to completeness or 
accuracy and are subject to change without notice.  Any comments or statements 
made herein do not necessarily reflect those of Nerve Centrex Software (India) 
Pvt. Ltd., its subsidiaries and affiliates.

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify Nerve Centrex 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. Nerve Centrex 
Software (India) Pvt. Ltd., its subsidiaries and affiliates therefore does not 
accept liability for any errors or omissions in the contents of this message, 
which arise as a result of e-mail transmission. Although this transmission and 
any attachments are believed to be free of any virus or other defect that might 
affect any computer system into which it is received and opened, it is the 
responsibility of the recipient to ensure that it is virus free and no 
responsibility is accepted by Nerve Centrex Software (India) Pvt. Ltd., its 
subsidiaries and affiliates, as applicable, for any loss or damage arising in 
any way from its use.

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Query performance in MarkLogic

2015-02-16 Thread Erik Zander
Correction

Of course if you want both content in one query you use an or query not an and 
query.

But I don't see that either of the queries will help as they return the result 
as two result entries at least.

So yes first acess one document then complement that with information from the 
other one.

Sorry for my brief brain crash, I blame it being Monday :-)

Regards
Erik

Sent from Divide

On 16 feb 2015 12:06:00, Erik Zander erik.zan...@studentlitteratur.se wrote:

Hi Srinivas,

Well yes, at some point you will need to access both documents if you want some 
combination of them but this could be done with one query by using cts:and-query
A good place for more on search is http://docs.marklogic.com/guide/search-dev 
and more specifically 
http://docs.marklogic.com/guide/search-dev/structured-query for an example of 
an and query.

Regards
Erik

Från: Srinivas [mailto:srini...@nervecentrex.com]
Skickat: den 16 februari 2015 10:31
Till: 'MarkLogic Developer Discussion'
Ämne: Re: [MarkLogic Dev General] Query performance in MarkLogic

Hi Eric,

Thank you for the suggestion but I wonder, do I need to make 2 queries to get 
the complete data of user?

First query to get the data from user.xml and then query group.xml to get the 
group name. If am wrong somewhere excuse me. Am new to MarkLogic.

Thanks  Regards,
Srinivas | Sr CakePHP Programmer
+91 - 9538025790 | srini...@nervecentrex.commailto:srini...@nervecentrex.com

nerve centrex software (India) pvt. Ltd.
122 soudhamini 3rd main gruhalakshmi layout II stage
Kamalanagar Bangalore 560079 Karnataka India

[cid:image002.png@01CF74D9.64936420]


Disclaimer: This communication is for informational purposes only. It is not 
intended as an offer or solicitation for the purchase or sale of any financial 
instrument or as an official confirmation of any transaction. All market 
prices, data and other information are not warranted as to completeness or 
accuracy and are subject to change without notice.  Any comments or statements 
made herein do not necessarily reflect those of Nerve Centrex Software (India) 
Pvt. Ltd., its subsidiaries and affiliates.

This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify Nerve Centrex 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. Nerve Centrex 
Software (India) Pvt. Ltd., its subsidiaries and affiliates therefore does not 
accept liability for any errors or omissions in the contents of this message, 
which arise as a result of e-mail transmission. Although this transmission and 
any attachments are believed to be free of any virus or other defect that might 
affect any computer system into which it is received and opened, it is the 
responsibility of the recipient to ensure that it is virus free and no 
responsibility is accepted by Nerve Centrex Software (India) Pvt. Ltd., its 
subsidiaries and affiliates, as applicable, for any loss or damage arising in 
any way from its use.

From: 
general-boun...@developer.marklogic.commailto:general-boun...@developer.marklogic.com
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Monday, February 16, 2015 2:33 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Query performance in MarkLogic

Hi Srinivas,

I was wondering why you doesn’t use the xml:id attribute like this
/User1.xml



User xml:id=”1”



  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group xml:id=”10”
NameAdmin/Name
/Group

With this structure you could use an element attribute query (to get good 
performance you would need to make sure the xml:id attribute is indexed)
cts:search(//module,
cts:element-attribute-value-query(
  xs:QName(Group),

  xs:QName(xml:id),
  $group-id-referenced))

About performance in general if you make use of indexes in you searches you 
geet good performance.

Regards
Erik
Från: Srinivas [mailto:srini...@nervecentrex.com]
Skickat: den 16 februari 2015 06:54
Till: 'MarkLogic Developer Discussion'
Ämne: [MarkLogic Dev General] Query performance in MarkLogic

Hi All,

I was trying to build a database in MarkLogic with following document format.

/User1.xml



User

  Id1/Id

  Group_id10/Group_id

  NameMark/Name

  Project

NameProject1/Name

  /Project
/User

/Group10.xml

Group
Id10/Id
NameAdmin/Name
/Group

If I want to get the group name for the user id 1, how could I achieve it ? 
Shall I use qbe query to find the name or any other mechanism is there to 
connect both documents?

And if I use multiple queries, am I losing the performance here?


Thanks  Regards,
Srinivas

Re: [MarkLogic Dev General] Unsubscribe

2014-12-08 Thread Erik Zander
Terry
You may unsubscribe at the following link
http://developer.marklogic.com/mailman/listinfo/general
Regards
Erik

Från: Austin, Theresa [mailto:]
Skickat: den 8 december 2014 14:43
Till: General@developer.marklogic.com
Ämne: [MarkLogic Dev General] Unsubscribe

Good morning.

Please remove me from your mailing list. My inbox is getting flooded most days 
of the week.

- Terry


Theresa Austin
Strategic Architect
Enterprise Architecture (EA)
aust...@aetna.commailto:aust...@aetna.com
215-775-2386

This e-mail may contain confidential or privileged information. If you think 
you have received this e-mail in error, please advise the sender by reply 
e-mail and then delete this e-mail immediately. Thank you. Aetna
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] MLCP - document_selector option

2014-10-27 Thread Erik Zander
Joel

Whit the risk of not fully understood the problem I was wondering if you could 
not do the following:
Run you xqurey that
-takes your parameters via http get
-put matching documents into a new collection
Use mlcp to retrieve that collection
If needed call an xquery script that removes the created collection (not the 
document within so NOT xdmp:delete-collection)

Regards
Erik Zander

Från: Joel Wilson Gunasekaran [mailto:joelwilson.gunaseka...@gmail.com]
Skickat: den 24 oktober 2014 20:37
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] MLCP - document_selector option

Thanks for your suggestion Dave.
Huge set of documents meaning, the number of documents returned by the query 
would be huge.

For example, we would like to run an xquery to get a set of asset metadata from 
MarkLogic based on certain parameters and the number of documents returned may 
be around 1000.

I tried XQSync, and it works for us.

Please let us know if there are any better solutions.

Thanks
Joel Wilson G


On Oct 24, 2014, at 5:06 AM, Dave Cassel 
dave.cas...@marklogic.commailto:dave.cas...@marklogic.com wrote:

Is it a huge set of documents, or a small set of huge documents? If the latter, 
the simplest thing might be using the REST API. Set up a REST API app server, 
then look at the fourth example 
herehttp://docs.marklogic.com/REST/GET/v1/documents to retrieve the set of 
documents through curl.

--
Dave Cassel
Developer Community Manager
MarkLogic Corporationhttp://www.marklogic.com/
Cell:  +1-484-798-8720



From: Joel Wilson Gunasekaran 
joelwilson.gunaseka...@gmail.commailto:joelwilson.gunaseka...@gmail.com
Reply-To: MarkLogic Developer Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Thursday, October 23, 2014 at 2:42 PM
To: general@developer.marklogic.commailto:general@developer.marklogic.com 
general@developer.marklogic.commailto:general@developer.marklogic.com
Subject: [MarkLogic Dev General] MLCP - document_selector option

Hi,

We have a requirement, where we would like to export a few xml documents to do 
some analysis.
Running a query in qconsole to retrieve the documents isn't working for cases 
where the output of the query is huge, so we are exploring other options.

MLCP has an option to export content, and there is a document_selector 
filter(http://docs.marklogic.com/guide/ingestion/content-pump#id_89322), but I 
couldn't find any examples of this option in the documentation or in the 
internet.

Have you used this option? If so can you please provide an example?

Also, let me know if there are other options where you can run a simple xquery 
to extract huge sets of documents from MarkLogic.

Thanks
Joel Wilson G
___
General mailing list
General@developer.marklogic.commailto:General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] XSLT check if result document has been created

2014-08-04 Thread Erik Zander
Hi
Just a last update on this,

First of all thanks for all suggestions, after suggestions from a friend I 
ended up with was using recursion.

Thanks again
Erik 

-Ursprungligt meddelande-
Från: Garrow, Heather [mailto:hgar...@newsbank.com] 
Skickat: den 31 juli 2014 13:45
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] XSLT check if result document has been created

The closest thing to a map I've found in XSLT is xsl:key 

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Thursday, July 31, 2014 4:16 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] XSLT check if result document has been 
created

Hello Mike

Yes to use a map would be ideal, and actually one of my first thoughts however 
upon googling for maps and xslt I got the impression that XSLT doesn't have 
maps, is that the case?

If so I would have to write my own map which I admit I haven't yet figured out 
as XSLT is declarative... Once or twice I miss java...

Anyway thanks for pointing out a direction :)

Regards
Erik

-Ursprungligt meddelande-
Från: Michael Blakeley [mailto:m...@blakeley.com]
Skickat: den 29 juli 2014 20:17
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] XSLT check if result document has been created

If you want to skip the duplicates, one common pattern is to track them using a 
map. You could also use distinct-values, but a map can be more efficient.

let $m-seen := map:map()
for $i in $list
let $key := $i/@id/string() (: Or some other expr based on $i :)
let $is-duplicate := map:contains($m-seen, $key)
let $_ := if ($is-duplicate) then () else map:put($m-seen, $key, 1)
where not($is-duplicate)
return $i (: Or do other processing on $i :)

The map starts empty. While processing each item we check to see if it already 
has a map entry. If it does, we consider it a duplicate and do nothing. 
Otherwise we add it to the map and finish processing it. So if there are two or 
more items with the same @id value, only the first one will be processed.

Translating this logic into XSLT is left as an exercise. The logic is the same 
but you'd use xsl:variable elements, etc.

-- Mike

On 29 Jul 2014, at 03:31 , Erik Zander erik.zan...@studentlitteratur.se wrote:

 Thank you Ryan and Mary
  
 Sadly it didn't work as I wished for, I still get duplicate uris which is 
 what the if statement was introduced to remove..
 XSLT-DUPRESULTURIS: (err:XTDE1490) xsl:result-document href=out/{ 
 $id }.xml method=xml indent=yes /xsl:result-document -- Two 
 final trees cannot have the same URI:
 out/36CD63C6006FE011A8EE9FEB54B1132A.xml
  
 I have not yet understood completely in what ways it's possible to read and 
 manipulate the result tree in xslt, if I only could address that I would be 
 able to see if a specific id was in the result tree and then not process.
 But as it stands now I think I have to rethink how I can make sure to only 
 process each image once even thou its reoccurring in the source xml.
 Thanks anyway
 /Erik Zander
 Från: Ryan Dew [mailto:ryan.j@gmail.com]
 Skickat: den 28 juli 2014 17:20
 Till: MarkLogic Developer Discussion
 Ämne: Re: [MarkLogic Dev General] XSLT check if result document has 
 been created
  
 I believe you should be able to do something like the following to get what 
 you want:
  
 xsl:template match=//db:informalfigure[descendant::db:imagedata and 
 @role='figure']
 
 
 
 xsl:variable name=curImage 
 select=substring-after(.//@fileref,'/')/
 
 xsl:variable name=id 
 select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
 xsl:if 
 test=not(doc-available(xdmp:resolve-uri(string-join(('out/',$id,'.xml'),''),xdmp:node-uri(.
!--This check fails, am I doing it incorrectly or is it the way xslt 
 processes document that makes it hard to check if the id have been 
 encountered before?--
 
 xsl:result-document method=xml href=out/{$id}.xml 
 indent=yes
  
 
 On Mon, Jul 28, 2014 at 9:08 AM, Mary Holstege mary.holst...@marklogic.com 
 wrote:
 
 I think you may be running afoul of URI resolution.
 Since the URI you are giving to doc-available is a relative URI, it 
 will be resolved relative to the static base URI, which per XSLT is 
 the URI of the stylesheet itself.
 
 //Mary
 
 On Mon, 28 Jul 2014 07:58:04 -0700, Erik Zander 
 erik.zan...@studentlitteratur.se wrote:
 
  Hi All
 
  I'm working on an xslt transform where I'm extracting data about 
  images from a document and put that data into result document, It 
  all works fine except for when the same image occurs more than once 
  as I then get conflicting uris,
 
  my code looks like this
  xsl:template match=//db:informalfigure[descendant::db:imagedata
  and @role='figure']
 
 
 
  xsl:variable name=curImage
  select=substring-after(.//@fileref

Re: [MarkLogic Dev General] XSLT check if result document has been created

2014-07-31 Thread Erik Zander
Hello Mike

Yes to use a map would be ideal, and actually one of my first thoughts however 
upon googling for maps and xslt I got the impression that XSLT doesn't have 
maps, is that the case?

If so I would have to write my own map which I admit I haven't yet figured out 
as XSLT is declarative... Once or twice I miss java...

Anyway thanks for pointing out a direction :)

Regards
Erik

-Ursprungligt meddelande-
Från: Michael Blakeley [mailto:m...@blakeley.com] 
Skickat: den 29 juli 2014 20:17
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] XSLT check if result document has been created

If you want to skip the duplicates, one common pattern is to track them using a 
map. You could also use distinct-values, but a map can be more efficient.

let $m-seen := map:map()
for $i in $list
let $key := $i/@id/string() (: Or some other expr based on $i :)
let $is-duplicate := map:contains($m-seen, $key)
let $_ := if ($is-duplicate) then () else map:put($m-seen, $key, 1)
where not($is-duplicate)
return $i (: Or do other processing on $i :)

The map starts empty. While processing each item we check to see if it already 
has a map entry. If it does, we consider it a duplicate and do nothing. 
Otherwise we add it to the map and finish processing it. So if there are two or 
more items with the same @id value, only the first one will be processed.

Translating this logic into XSLT is left as an exercise. The logic is the same 
but you'd use xsl:variable elements, etc.

-- Mike

On 29 Jul 2014, at 03:31 , Erik Zander erik.zan...@studentlitteratur.se wrote:

 Thank you Ryan and Mary
  
 Sadly it didn't work as I wished for, I still get duplicate uris which is 
 what the if statement was introduced to remove..
 XSLT-DUPRESULTURIS: (err:XTDE1490) xsl:result-document href=out/{ 
 $id }.xml method=xml indent=yes /xsl:result-document -- Two 
 final trees cannot have the same URI: 
 out/36CD63C6006FE011A8EE9FEB54B1132A.xml
  
 I have not yet understood completely in what ways it's possible to read and 
 manipulate the result tree in xslt, if I only could address that I would be 
 able to see if a specific id was in the result tree and then not process.
 But as it stands now I think I have to rethink how I can make sure to only 
 process each image once even thou its reoccurring in the source xml.
 Thanks anyway
 /Erik Zander
 Från: Ryan Dew [mailto:ryan.j@gmail.com]
 Skickat: den 28 juli 2014 17:20
 Till: MarkLogic Developer Discussion
 Ämne: Re: [MarkLogic Dev General] XSLT check if result document has 
 been created
  
 I believe you should be able to do something like the following to get what 
 you want:
  
 xsl:template match=//db:informalfigure[descendant::db:imagedata and 
 @role='figure']
 
 
 
 xsl:variable name=curImage 
 select=substring-after(.//@fileref,'/')/
 
 xsl:variable name=id 
 select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
 xsl:if 
 test=not(doc-available(xdmp:resolve-uri(string-join(('out/',$id,'.xml'),''),xdmp:node-uri(.
!--This check fails, am I doing it incorrectly or is it the way xslt 
 processes document that makes it hard to check if the id have been 
 encountered before?--
 
 xsl:result-document method=xml href=out/{$id}.xml 
 indent=yes
  
 
 On Mon, Jul 28, 2014 at 9:08 AM, Mary Holstege mary.holst...@marklogic.com 
 wrote:
 
 I think you may be running afoul of URI resolution.
 Since the URI you are giving to doc-available is a relative URI, it 
 will be resolved relative to the static base URI, which per XSLT is 
 the URI of the stylesheet itself.
 
 //Mary
 
 On Mon, 28 Jul 2014 07:58:04 -0700, Erik Zander 
 erik.zan...@studentlitteratur.se wrote:
 
  Hi All
 
  I'm working on an xslt transform where I'm extracting data about 
  images from a document and put that data into result document, It 
  all works fine except for when the same image occurs more than once 
  as I then get conflicting uris,
 
  my code looks like this
  xsl:template match=//db:informalfigure[descendant::db:imagedata 
  and @role='figure']
 
 
 
  xsl:variable name=curImage
  select=substring-after(.//@fileref,'/')/
 
  xsl:variable name=id
  select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
  xsl:if
  test=not(doc-available(string-join(('out/',$id,'.xml'),'')))
  !--This check fails, am I doing it incorrectly or is it the way 
  xslt processes document that makes it hard to check if the id have 
  been encountered before?--
 
  xsl:result-document method=xml href=out/{$id}.xml
  indent=yes
 
  Ideally I would like to be able to check if the result document have 
  been created or not and after that decide if I want to update it 
  with more information or just leave it be.
 
  Would appreciate any help on the subject
 
  Best regards
  Erik
 
 
 --
 Using Opera's revolutionary email client: http://www.opera.com

Re: [MarkLogic Dev General] XSLT check if result document has been created

2014-07-29 Thread Erik Zander
Thank you Ryan and Mary

Sadly it didn’t work as I wished for, I still get duplicate uris which is what 
the if statement was introduced to remove….
XSLT-DUPRESULTURIS: (err:XTDE1490) xsl:result-document href=out/{ $id }.xml 
method=xml indent=yes” /xsl:result-document -- Two final trees cannot 
have the same URI: out/36CD63C6006FE011A8EE9FEB54B1132A.xml

I have not yet understood completely in what ways it’s possible to read and 
manipulate the result tree in xslt, if I only could address that I would be 
able to see if a specific id was in the result tree and then not process.
But as it stands now I think I have to rethink how I can make sure to only 
process each image once even thou its reoccurring in the source xml.
Thanks anyway
/Erik Zander
Från: Ryan Dew [mailto:ryan.j@gmail.com]
Skickat: den 28 juli 2014 17:20
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] XSLT check if result document has been created

I believe you should be able to do something like the following to get what you 
want:

xsl:template match=//db:informalfigure[descendant::db:imagedata and 
@role='figure']



xsl:variable name=curImage 
select=substring-after(.//@fileref,'/')/mailto:.//@fileref,'/')%22/

xsl:variable name=id 
select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
xsl:if 
test=not(doc-available(xdmp:resolve-uri(string-join(('out/',$id,'.xml'),''),xdmp:node-uri(.
   !--This check fails, am I doing it incorrectly or is it the way xslt 
processes document that makes it hard to check if the id have been encountered 
before?--

xsl:result-document method=xml href=out/{$id}.xml indent=yes

On Mon, Jul 28, 2014 at 9:08 AM, Mary Holstege 
mary.holst...@marklogic.commailto:mary.holst...@marklogic.com wrote:

I think you may be running afoul of URI resolution.
Since the URI you are giving to doc-available is a relative
URI, it will be resolved relative to the static base URI, which
per XSLT is the URI of the stylesheet itself.

//Mary

On Mon, 28 Jul 2014 07:58:04 -0700, Erik Zander
erik.zan...@studentlitteratur.semailto:erik.zan...@studentlitteratur.se 
wrote:

 Hi All

 I’m working on an xslt transform where I’m extracting data about images
 from a document and put
 that data into result document, It all works fine except for when the
 same image occurs more than once as I then get conflicting uris,

 my code looks like this
 xsl:template match=//db:informalfigure[descendant::db:imagedata and
 @role='figure']



 xsl:variable name=curImage
 select=substring-after(.//@fileref,'/')/mailto:.//@fileref,'/')%22/

 xsl:variable name=id
 select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
 xsl:if
 test=not(doc-available(string-join(('out/',$id,'.xml'),'')))
 !--This check fails, am I doing it incorrectly or is it the way xslt
 processes document that makes it hard to check if the id have been
 encountered before?--

 xsl:result-document method=xml href=out/{$id}.xml
 indent=yes

 Ideally I would like to be able to check if the result document have
 been created or not and after that decide if I want to update it with
 more information or just leave it be.

 Would appreciate any help on the subject

 Best regards
 Erik

--
Using Opera's revolutionary email client: http://www.opera.com/mail/
___
General mailing list
General@developer.marklogic.commailto:General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] XSLT check if result document has been created

2014-07-28 Thread Erik Zander
Hi All

I’m working on an xslt transform where I’m extracting data about images from a 
document and put
that data into result document, It all works fine except for when the same 
image occurs more than once as I then get conflicting uris,

my code looks like this
xsl:template match=//db:informalfigure[descendant::db:imagedata and 
@role='figure']



xsl:variable name=curImage 
select=substring-after(.//@fileref,'/')/

xsl:variable name=id 
select=$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id/
xsl:if test=not(doc-available(string-join(('out/',$id,'.xml'),''))) 
  !--This check fails, am I doing it incorrectly or is it the way xslt 
processes document that makes it hard to check if the id have been encountered 
before?--

xsl:result-document method=xml href=out/{$id}.xml indent=yes

Ideally I would like to be able to check if the result document have been 
created or not and after that decide if I want to update it with more 
information or just leave it be.

Would appreciate any help on the subject

Best regards
Erik
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Sending document node as parameter to xdmp:xslt-invoke

2014-06-25 Thread Erik Zander
Thank you Mike

The solution using  constructors worked great.

Regards
Erik

-Ursprungligt meddelande-
Från: Michael Blakeley [mailto:m...@blakeley.com] 
Skickat: den 24 juni 2014 18:02
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] Sending document node as parameter to 
xdmp:xslt-invoke

The error message is telling you that what you're passing in is an element 
named images, not a document node.

Invalid coercion: images 
xmlns:map=http://marklogic.com/xdmp/map;#10;image#10;name9789144027975/image001.eps/name#10;id.../images
 as document-node()

You're passing in an element because you constructed the map entry using XML:

map:value{$metaDatabase}/map:value.

A document node can't live inside an element, so the evaluator unwrapped it for 
you. You can see this happening with a simple test.

map:map(
  map:map xmlns:map=http://marklogic.com/xdmp/map;
map:entry
  map:keyimageMetaData/map:key
  map:value{ document { '' } }/map:value
/map:entry/map:map)
! map:get(., map:keys(.))
! xdmp:describe(.)
=
text{}

That's a text node, not a document node.

There are a couple ways to fix this. The most concise is to change the expected 
parameter type:

xsl:param name=imageMetaData as=element()/

Another approach - possibly better - is to change the way you build your map. 
You're building a map using direct XML constructors, which is a little awkward 
in this context and makes it impossible to include a document node. Instead you 
could build the map using entry constructors and map:new(), something like this:

map:new(
  (map:entry('imageMetaData', $metaInputDoc),
   map:entry('metaDatabase', $metaDatabase)))

Now you have a map:map item, and its map entries can contain document nodes. 
Here's a test to prove that this works:

map:new(
  (map:entry('imageMetaData', document { '' }),
   map:entry('metaDatabase', document { '' })))
! map:get(., map:keys(.))
! xdmp:describe(.)
=
document{}
document{}

-- Mike

On 24 Jun 2014, at 08:00 , Erik Zander erik.zan...@studentlitteratur.se wrote:

 Hi all!
  
 I'm currently working  on a xslt transform driven from xquery and have some 
 parameters including a document node that I want to pass to the xslt.
  
 However I get an error whit the following code.
  
 ...
 let $metaInputDoc := xdmp:eval('declare variable $metaInputPath external;
 
 fn:doc($metaInputPath)',$evalParams,$xqueryevalOptions)
 let $imageParams :=  map:map(
 map:map xmlns:map=http://marklogic.com/xdmp/map;
 map:entry
map:keyimageMetaData/map:key   
  
 map:value{$metaInputDoc}/map:value
 /map:entry
 map:entry
 map:keymetaDatabase/map:key
 map:value{$metaDatabase}/map:value
 /map:entry
 map:entry
 
 /map:map)
 
 
 
 (:here the problems begins:)
 let $metaDocs := 
 xdmp:xslt-invoke(/bilddatabas/Image_transform.xsl,$curDoc,$imagePara
 ms,optionsxmlns=xdmp:evaldatabase{xdmp:database($metaDatabase)}
 /database/options ) return $metaDocs
 
 
  
 And the xslt params are declared as follows
  
 ?xml version=1.0 encoding=UTF-8? xsl:stylesheet 
 xmlns:xsl=http://www.w3.org/1999/XSL/Transformxmlns:db=http://docbook.org/ns/docbookxmlns:xs=http://www.w3.org/2001/XMLSchema;
  version=2.0
 !-- Paramaters to the transform --
 
 !--imageMetaData is the metadata created when the thumbnails are 
 created--
 xsl:param name=imageMetaData as=document-node()/
   
   
   
   -oxygen complains here
 xsl:param name=metaDatabase/
 
  
 And last the error message
  
 XDMP-AS: (err:XPTY0004) xsl:param name={ imageMetaData } as={ 
 document-node() }/xsl:param name={ metaDatabase }/xsl:param 
 name={ thumbsBaseDir } as={ xs:string }/xsl:param name={ 
 hostName ... Shortend it down... -- Invalid coercion: images 
 xmlns:map=http://marklogic.com/xdmp/map;#10;image#10;name97891
 44027975/image001.eps/name#10;id.../images as document-node()
  
  
  
  
 Is this that it's not possible to pass a document node as a parameter into an 
 xslt transform from xquery in marklogic or is it that I'm doing it wrong?
  
 Any help is appreciated J
  
 Best Regards
 Erik
  
 ___
 General mailing list
 General@developer.marklogic.com
 http://developer.marklogic.com/mailman/listinfo/general


___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Sending document node as parameter to xdmp:xslt-invoke

2014-06-24 Thread Erik Zander
Hi all!

I'm currently working  on a xslt transform driven from xquery and have some 
parameters including a document node that I want to pass to the xslt.

However I get an error whit the following code.

.
let $metaInputDoc := xdmp:eval('declare variable $metaInputPath external;

fn:doc($metaInputPath)',$evalParams,$xqueryevalOptions)
let $imageParams :=  map:map(
map:map xmlns:map=http://marklogic.com/xdmp/map;
map:entry
map:keyimageMetaData/map:key
map:value{$metaInputDoc}/map:value
/map:entry
map:entry
map:keymetaDatabase/map:key
map:value{$metaDatabase}/map:value
/map:entry
map:entry

/map:map)



(:here the problems begins:)
let $metaDocs := 
xdmp:xslt-invoke(/bilddatabas/Image_transform.xsl,$curDoc,$imageParams,options
 
xmlns=xdmp:evaldatabase{xdmp:database($metaDatabase)}/database/options 
)
return $metaDocs



And the xslt params are declared as follows

?xml version=1.0 encoding=UTF-8?
xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
xmlns:db=http://docbook.org/ns/docbook; 
xmlns:xs=http://www.w3.org/2001/XMLSchema; version=2.0
!-- Paramaters to the transform --

!--imageMetaData is the metadata created when the thumbnails are created--
xsl:param name=imageMetaData as=document-node()/



-oxygen complains here
xsl:param name=metaDatabase/


And last the error message

XDMP-AS: (err:XPTY0004) xsl:param name={ imageMetaData } as={ 
document-node() }/xsl:param name={ metaDatabase }/xsl:param name={ 
thumbsBaseDir } as={ xs:string }/xsl:param name={ hostName . Shortend 
it down. -- Invalid coercion: images 
xmlns:map=http://marklogic.com/xdmp/map;#10;image#10;name9789144027975/image001.eps/name#10;id.../images
 as document-node()




Is this that it's not possible to pass a document node as a parameter into an 
xslt transform from xquery in marklogic or is it that I'm doing it wrong?

Any help is appreciated :)

Best Regards
Erik

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Disable keyboard shortcuts in query console

2012-12-13 Thread Erik Zander
All

I'm wondering if there's any way to easily disable or reconfigure the keyboard 
shortcuts in query console.

The reason I wondering is because I have a Swedish keyboard and all characters 
placed under the altgr key results in a sudden change of query window.

Regards
Erik
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] search function and results per

2012-08-07 Thread Erik Zander
Damon
Thank you for encouragement, after discussion whit the developers they agreed 
to give it a try, if I made the splitting.
However they suggested that I split the documents into text nodes to achieve a 
search index like behavior this as they want to be able to score the results 
based on the following criteria

Hierarchy of single words:
1)  Words in the chapter title appearing in the register
2)  Words in the chapter title
3)  Words in the section header appearing in the register
4)  Words in the section heading
5)  Words set aside from texflow present in the register
6)  Words set aside from texflow
7)  Part of the words in the chapter title appearing in the register
8)  Part of the words in the chapter title
9)  Part of the words in the section header appearing in the register
10) Part of the words in the section heading
11) Part of Words set aside from texflow present in the register
12) Part of Words set aside from texflow

Hierarchy phrases or multiple words:
The first Exact phrase as 1-12 above
The second Two or more words in accordance with 1-12 above-The greater the 
number of words that meet the requirements, the higher the relevance
The third Words set aside from texflow or parts of higher priority Words set 
aside from texflow nearer within the text they are in  


As of this I was thinking that maybe an search index structure something like 
the following 
si:node xmlns si:= html://www.yadayada.com/searchindex
si:textTHE TEXT NODE FROM DOCUMENT/si:text
si:parentTHE ELEMENT TYPE OF THE PARENT NODE/si:parent
si:pathTHE ORIGINAL PATH OF THE NODE/si:path
si:node

Might be good to store as separet documents that search in those fragments and 
later go back to the original document returning the results scored as above.

What disadvantages do you see whit my approach or could it work?

Would it be more effective to make multiple splits as you suggested?

Regards
Erik


Message: 2
Date: Mon, 6 Aug 2012 07:11:18 -0700
From: Damon Feldman damon.feld...@marklogic.com
Subject: Re: [MarkLogic Dev General] search function and results per
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID:
d20c296d14127d4ebd176ad949d8a75a20576eb...@exchg-be.marklogic.com
Content-Type: text/plain; charset=us-ascii

Erik,

I recommend you work with the developers to make the solution work. If they 
move content to SQL they will be splitting the content far more severely than 
they would in MarkLogic. Splitting in XQuery may be as simple as (depending 
on the complexities of docbook):

for $section in $book//(db:para | db:title | etc. etc.) return 
xdmp:document-insert(concat(/separateBookElements/, xdmp:random(), /, 
fn:base-uri($section)), $section)

Then you can search to your heart's content, and add relevance boosts for 
titles and other important elements. The overall book URI will be extractable 
from the searchable element URI. You still get all the advantages of relevance, 
tf/idf weights, fields, phrase-through, prhase-around, case, stemming, 
wildcards, transforms and the like. Your exact solution will vary depending on 
your needs; this is to illustrate that it is not that hard.

Splitting in SQL means modeling the entire domain as a set of tables and 
keys, and developing a new mapping layer.

Yours,
Damon

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Monday, August 06, 2012 4:07 AM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] search function and results per

Thank you Mike,

Your information sadly match with the small pieces of information I have found 
elsewhere (was hoping on one miracle xquery line :) )

However the result of not being able to achieve the result we want without 
splitting the books(documents) or introducing any fragments (after some more 
research that sound as a bad way to go), is that the main developers have 
extracted all the data into SQL ...

I would still be able to get back to them with an easy solution but I won't 
keep my breath.

Thanks and regards
Erik


--

Message: 3
Date: Fri, 3 Aug 2012 08:26:11 -0700
From: Michael Blakeley m...@blakeley.com
Subject: Re: [MarkLogic Dev General] search function and results per
document trunktation error
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID: ee2c2cc0-ab11-449a-bef7-0778010f1...@blakeley.com
Content-Type: text/plain; charset=us-ascii

Relevance scores are calculated at the fragment level. There are no 
sub-fragment relevance calculations in MarkLogic. In my opinion the best 
approach is to live with this, and stop worrying about which sequence of words 
might be the most relevant to the user. The first reasonable snippet is likely 
to be from a summary, which should... summarize the document content. If not, 
let the users

Re: [MarkLogic Dev General] search function and results per

2012-08-06 Thread Erik Zander
Thank you Mike,

Your information sadly match with the small pieces of information I have found 
elsewhere (was hoping on one miracle xquery line :) )

However the result of not being able to achieve the result we want without 
splitting the books(documents) or introducing any fragments (after some more 
research that sound as a bad way to go), is that the main developers have 
extracted all the data into SQL ...

I would still be able to get back to them with an easy solution but I won't 
keep my breath.

Thanks and regards
Erik


--

Message: 3
Date: Fri, 3 Aug 2012 08:26:11 -0700
From: Michael Blakeley m...@blakeley.com
Subject: Re: [MarkLogic Dev General] search function and results per
document trunktation error
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID: ee2c2cc0-ab11-449a-bef7-0778010f1...@blakeley.com
Content-Type: text/plain; charset=us-ascii

Relevance scores are calculated at the fragment level. There are no 
sub-fragment relevance calculations in MarkLogic. In my opinion the best 
approach is to live with this, and stop worrying about which sequence of words 
might be the most relevant to the user. The first reasonable snippet is likely 
to be from a summary, which should... summarize the document content. If not, 
let the users read the documents and figure that out for themselves.

But if you have to have sub-document scoring, there are basically three 
approaches.

In my opinion the least-bad strategy is to store your content at multiple 
levels of granularity. This is a typical disk space vs CPU trade-off: there 
might be hundreds or thousands of ancillary documents per main document, where 
each ancillary document stores a single element at whatever level you want to 
form your snippets. Once you have that, you would have to implement a fairly 
complicated two-pass search algorithm. Pass 1 would search the main documents 
and work out which main document URIs ought to be on the page. Then pass 2 
would search the ancillary docs corresponding to those URIs, to gather up the N 
most relevant snippets for each URI. Some of this code would be highly 
performance-sensitive, but with the right implementation it should perform well.

The next least-bad approach might be to fragment your documents. But relevance 
does not roll up from sub-fragments to the document level. So by fragmenting on 
title, you will remove title from the relevance calculations for the parent 
document. Because there is no way to automatically consider an element to live 
in two fragments at once, this approach sacrifices main-document relevance in 
the name of snippet-level relevance. So fragmenting on title and para is 
unlikely to yield the results you want.

Probably the worst strategy is to try to implement element-level scoring for 
yourself. This is especially difficult because XQuery does not have direct 
access to the TF or IDF data. This mostly has to be done at query time, too, so 
the scoring is likely to be slow, or bad, or both.

-- Mike

On 3 Aug 2012, at 07:29 , Erik Zander wrote:

 Hi Geert
 
 Here's the function call now whiotu snipets but as the problem appears 
 whis as small amont of code as this thsi is what we currently work on
 
 let $result := 
 cts:search(fn:collection(Allmanmedicin)//(title|para),$query, 
 (score-simple))  for $m in $result
return 
  fn:concat(cts:score($m),' - ',fn:base-uri($m))
 
 
 The problem that we have is that for one specific search all results in on 
 document have the same score.
 
 What we need is for the score to be separate from the document so that the 
 result isn't returned per book but instead returned depending of match.
 
 I was hoping that the score-simple option would do the trick and not care 
 from which document the match came from but it do not appear so.
 
 Regards
 Erik
 
 =
 
 Message: 3
 Date: Fri, 3 Aug 2012 10:47:06 +0200
 From: Erik Zander erik.zan...@studentlitteratur.se
 Subject: [MarkLogic Dev General] search function and results per
   documenttrunktation error
 To: general@developer.marklogic.com
   general@developer.marklogic.com
 Message-ID:
   
 666D23968830644D92011BDE450FBE8031E332D12D@DRSTUEX01.studentlitteratu
 r.corp
   
 Content-Type: text/plain; charset=iso-8859-1
 
 Hi All
 
 I have a problem with the search functions both cts:search and search:search.
 
 The problem is that when doing a search over a collection documents with many 
 matches are prioritized and first after that the custom weights are added.
 
 As a result the search have truncated the result even before we are able to 
 impact the score of the matches.
 
 What we would need would be to have the matches returned independent 
 of in what document the specific element lays. This so that we could 
 prioritize for example all relevant docbook:titles first then go into 
 docbook:blockquotes and lastly single docbook:paras in more than one

Re: [MarkLogic Dev General] Marklogic Webdav not connecting

2012-06-27 Thread Erik Zander
Hi Djaun!

As I don't know your windows version but as it sounds its maybe win 7 (this 
should be mostly the same for vista) that your trying to connect from.

Could it be that your previous successful connections was made from a Win XP 
machine?

If so here's some things to take note of 

*The Web services service isn't enabled by default in win 7 as this is needed 
we want to start that one automatically. 

*Windows 7 do not support basic authentication if not via ssh this can be 
changed in the registry in the BasicAuthLevel key found under 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters to 
enable basic authentications without ssh set the value to 2.

*To speed things up open Internet Explorer and open settings under the 
connections tab click on lan settings in this new window uncheck the detect 
settings automatically box

*Lastly restart to let the settings take place.


Hope this helps 
Regards
Erik

===

Message: 4
Date: Wed, 27 Jun 2012 06:12:04 +
From: DJaun Maclin dmac...@wattnet.net
Subject: Re: [MarkLogic Dev General] Marklogic Webdav not connecting
To: General Discussion general@developer.marklogic.com
Cc: Robert Tuten rtu...@wattnet.net,  Matt Leshinskie
matt.leshins...@marklogic.com
Message-ID: cc100e14.5a14%dmac...@wattnet.net
Content-Type: text/plain; charset=us-ascii

Thanks for the reply, Danny!
Automatic directory creation is enabled for the database.

From: Danny Sokolsky 
danny.sokol...@marklogic.commailto:danny.sokol...@marklogic.com
Reply-To: General Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Tue, 26 Jun 2012 16:12:05 -0700
To: General Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Cc: Robert Tuten rtu...@wattnet.netmailto:rtu...@wattnet.net, Matt 
Leshinskie matt.leshins...@marklogic.commailto:matt.leshins...@marklogic.com
Subject: Re: [MarkLogic Dev General] Marklogic Webdav not connecting

Is automatic directory creation enabled for the database?
-- next part --
An HTML attachment was scrubbed...
URL: 
http://community.marklogic.com/pipermail/general/attachments/20120627/17f0e739/attachment-0001.html
 

--

Message: 5
Date: Tue, 26 Jun 2012 23:12:02 -0700
From: Danny Sokolsky danny.sokol...@marklogic.com
Subject: Re: [MarkLogic Dev General] Marklogic Webdav not connecting
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID:
c9924d15b04672479b089f7d55ffc1322261a79...@exchg-be.marklogic.com
Content-Type: text/plain; charset=us-ascii

Here are a few other things to look at:

* Make sure the root directory exists in the database.  For example, if the 
root is / on the WebDAV server, make sure the directory / exists (  
xdmp:directory-properties(/) should return a properties document with a 
directory element, for example)
* make sure the user you are logging into the WebDAV server has permissions on 
that root directory.  Try logging in as a user with the admin role--=if that 
works but another user does not, then the user probably does not have 
permissions on the root directory.

-Danny

From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] On Behalf Of DJaun Maclin 
[dmac...@wattnet.net]
Sent: Tuesday, June 26, 2012 11:12 PM
To: General Discussion
Cc: Robert Tuten; Matt Leshinskie
Subject: Re: [MarkLogic Dev General] Marklogic Webdav not connecting

Thanks for the reply, Danny!
Automatic directory creation is enabled for the database.

From: Danny Sokolsky 
danny.sokol...@marklogic.commailto:danny.sokol...@marklogic.com
Reply-To: General Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Date: Tue, 26 Jun 2012 16:12:05 -0700
To: General Discussion 
general@developer.marklogic.commailto:general@developer.marklogic.com
Cc: Robert Tuten rtu...@wattnet.netmailto:rtu...@wattnet.net, Matt 
Leshinskie matt.leshins...@marklogic.commailto:matt.leshins...@marklogic.com
Subject: Re: [MarkLogic Dev General] Marklogic Webdav not connecting

Is automatic directory creation enabled for the database?


--

___
General mailing list
General@developer.marklogic.com
http://community.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 96, Issue 69
***
___
General mailing list
General@developer.marklogic.com
http://community.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Search:Search result attribute path not returning full

2012-06-25 Thread Erik Zander
Will,

Thank you for information on the snippet I will look into it but as the other 
developers on site have made a workaround wherein they changing the actual 
search term it will be when times given.

Although I'm still curious about why the matches path attribute only delivers 
full path when it's not an exact match. 
As I understand it, the @path in the result is not the same as the @path in the 
result matches pathresult

The result path attribute I have gotten to believe is the path sent in into the 
searchable expression
Where the path attribute in the matches element is the or should be the direct 
path to where the match was found this is also the case when not matching 
exactly but as said before when the search term matches exactly the  parent to 
the text element is lost.

However as we got it working with the workaround this question have turned into 
one of more curiosity than urgent need to be solved.

Still would be nice to have an answer if we do something incorrectly or if it 
even might be a bug.

Regards
Erik


Message: 6
Date: Wed, 20 Jun 2012 17:18:42 +
From: Will Thompson wthomp...@jonesmcclure.com
Subject: Re: [MarkLogic Dev General] Search:Search result attribute
path not returning full
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID:
7A4B442E791E444DB6CA1B9BFA29E92B3613BECC@redman.jmpone.local
Content-Type: text/plain; charset=iso-8859-1

Erik,

If you want the matching element, then you could just use the @path from the 
search:result:

doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]/title

However, I'm not sure why the search:result path would more specific than the 
search:match path. Alternately, you could write a custom snippet module that 
does exactly what you want.

http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/search-dev-guide/search-api.xml%2361707

-Will


-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Wednesday, June 20, 2012 2:30 AM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] Search:Search result attribute path not 
returning full

Hi
First of all thank you Will for confirming what I have gotten to believe but 
not been entirely sure about that the path must be present in the searchable 
expression.

However this didn't change anything I still miss the title or emphasis or 
whatever tag when I get an exact match on the search term. 

For example with the old path expression I get the following answer when I 
search for Polikliniskt search:result index=1 
uri=/docbooks/9789144054360.xml 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;) score=49152 
confidence=0.399892 fitness=0.581481
search:snippet
  search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]
search:highlightPolikliniskt/search:highlight

If I change the pat in searchable expression so the options looks like the 
following 

I get the following result
search:result index=1 uri=/docbooks/9789144054360.xml 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]/title
 score=49152 confidence=0.399886 fitness=0.581463
search:snippet
  search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]search:highlightPolikliniskt/search:highlight/search:match
/search:snippet

Where the title still is missing in
search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]search:highlightPolikliniskt/search:highlight/search:match

I would have expected it to be like the following(spaces introduced around 
change)
search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]
  /title[1]   
search:highlightPolikliniskt/search:highlight/search:match

I'm happy for any help 

Regards
Erik

-Ursprungligt meddelande-
Fr?n: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] F?r 
general-requ...@developer.marklogic.com
Skickat: den 19 juni 2012 18:28
Till: general@developer.marklogic.com
?mne: General Digest, Vol 96, Issue 35

Send General mailing list submissions to
general@developer.marklogic.com

To subscribe or unsubscribe via the World Wide Web, visit
http://community.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
general-requ...@developer.marklogic.com

You can reach the person managing the list at
general-ow...@developer.marklogic.com

When replying, please edit your Subject line so it is more specific than Re: 
Contents of General digest...


Today's Topics:

   1. Re: Search:Search result attribute path not returning full
  path

Re: [MarkLogic Dev General] Search:Search result attribute path not returning full

2012-06-20 Thread Erik Zander
Hi
First of all thank you Will for confirming what I have gotten to believe but 
not been entirely sure about that the path must be present in the searchable 
expression.

However this didn't change anything I still miss the title or emphasis or 
whatever tag when I get an exact match on the search term. 

For example with the old path expression I get the following answer when I 
search for Polikliniskt
search:result index=1 uri=/docbooks/9789144054360.xml 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;) score=49152 
confidence=0.399892 fitness=0.581481
search:snippet
  search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]
search:highlightPolikliniskt/search:highlight

If I change the pat in searchable expression so the options looks like the 
following 

I get the following result
search:result index=1 uri=/docbooks/9789144054360.xml 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]/title
 score=49152 confidence=0.399886 fitness=0.581463
search:snippet
  search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]search:highlightPolikliniskt/search:highlight/search:match
/search:snippet

Where the title still is missing in 
search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]search:highlightPolikliniskt/search:highlight/search:match

I would have expected it to be like the following(spaces introduced around 
change)
search:match 
path=fn:doc(quot;/docbooks/9789144054360.xmlquot;)/book/chapter[1]/section[3]/section[1]/section[1]
  /title[1]   
search:highlightPolikliniskt/search:highlight/search:match

I'm happy for any help 

Regards
Erik

-Ursprungligt meddelande-
Från: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] För 
general-requ...@developer.marklogic.com
Skickat: den 19 juni 2012 18:28
Till: general@developer.marklogic.com
Ämne: General Digest, Vol 96, Issue 35

Send General mailing list submissions to
general@developer.marklogic.com

To subscribe or unsubscribe via the World Wide Web, visit
http://community.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
general-requ...@developer.marklogic.com

You can reach the person managing the list at
general-ow...@developer.marklogic.com

When replying, please edit your Subject line so it is more specific than Re: 
Contents of General digest...


Today's Topics:

   1. Re: Search:Search result attribute path not returning full
  path on exact match (Will Thompson)


--

Message: 1
Date: Tue, 19 Jun 2012 16:28:13 +
From: Will Thompson wthomp...@jonesmcclure.com
Subject: Re: [MarkLogic Dev General] Search:Search result attribute
path not returning full path on exact match
To: MarkLogic Developer Discussion general@developer.marklogic.com
Message-ID:
7A4B442E791E444DB6CA1B9BFA29E92B361381AB@redman.jmpone.local
Content-Type: text/plain; charset=iso-8859-1

Eric,

search:search will only return paths matching your searchable expression. You 
could pass //title as part of your $paths variable, or change your searchable 
expression: 
searchable-expression{concat($path,|//title)}/searchable-expression.

-Will


From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Erik Zander
Sent: Tuesday, June 19, 2012 8:40 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Search:Search result attribute path not 
returning full path on exact match

Hi

I have a problem with the search:search function and the result it gives me.
The problem shows when I for example searches for the word Polikliniskt in the 
following structure


section
titleM?tning av blodtryck/title
section
titlePolikliniskt/title
paraUnder normala fysiologiska f?rh?llande f?religger stora variationer i 
blodtryck

The resulting path attribute in the matches element in search result  for 
Polikliniskt do not contains the title element only //section/section. In 
other words the resulting path is //section/section instead of 
//section/section/title

This behavior only occurs when the search term exactly matches the text within 
one element so if it's only one word i.e. title above or when quotes are used 
to indicate match exactly like M?tning av blodtryck.

The search options can be found below for even more information.

  param $searchString (string) The query string
  param $paths (???)
  return (xml) The result
:)



declare function medlib:getSearchResult($searchQueryString, $path) {
  let $options :=
options xmlns=http://marklogic.com/appservices/search;
  searchable-expression{$path}/searchable-expression
  search-optionscore-logtfidf/search

[MarkLogic Dev General] Search:Search result attribute path not returning full path on exact match

2012-06-19 Thread Erik Zander
Hi

I have a problem with the search:search function and the result it gives me.
The problem shows when I for example searches for the word Polikliniskt in the 
following structure


section
titleMätning av blodtryck/title
section
titlePolikliniskt/title
paraUnder normala fysiologiska förhållande föreligger stora variationer i 
blodtryck

The resulting path attribute in the matches element in search result  for 
Polikliniskt do not contains the title element only //section/section. In 
other words the resulting path is //section/section instead of 
//section/section/title

This behavior only occurs when the search term exactly matches the text within 
one element so if it's only one word i.e. title above or when quotes are used 
to indicate match exactly like Mätning av blodtryck.

The search options can be found below for even more information.

  param $searchString (string) The query string
  param $paths (???)
  return (xml) The result
:)



declare function medlib:getSearchResult($searchQueryString, $path) {
  let $options :=
options xmlns=http://marklogic.com/appservices/search;
  searchable-expression{$path}/searchable-expression
  search-optionscore-logtfidf/search-option
  search-optionfiltered/search-option
  page-length10/page-length
 (: return-plantrue/return-plan:)
  term
term-optionlang=sv/term-option
term-optionwildcarded/term-option
term-optioncase-insensitive/term-option
term-optionwhitespace-insensitive/term-option
term-optionpunctuation-insensitive/term-option
term-optiondiacritic-sensitive/term-option
empty apply=all-results/
  /term
  transform-results apply=snippet
per-match-tokens100/per-match-tokens
max-matches2000/max-matches
max-snippet-chars4/max-snippet-chars
preferred-elements/
  /transform-results

  debugtrue/debug
/options

  let $result := search:search($searchQueryString, $options)

  return $result



Regards
Erik Zander
Developer @
Studentlitteratur AB
___
General mailing list
General@developer.marklogic.com
http://community.marklogic.com/mailman/listinfo/general