Re: [MarkLogic Dev General] How to use uri-match in the java api?

2017-03-31 Thread Justin Makeig
Apologies, I read too fast. You were asking about "Java", not "JavaScript". 
(Car is to carpet as Java is to JavaScript.)

You'll need to specify a URI values constraint. 

http://marklogic.com/appservices/search;>
  

  
  …


And then queryManager.values("uris", new JacksonHandle()) to use it. (Hat tip: 
Sam Mefford.)

Take a look at  and 
.

Justin

> On Mar 31, 2017, at 8:08 AM, Justin Makeig  
> wrote:
> 
> 
> 
> In general, the built-in functions map one-to-one between JavaScript and 
> XQuery. (There are exceptions.) Because hyphens aren't friendly in JavaScript 
> property names, we do a kabab-case to camel-case translation for all of the 
> names in JavaScript, i.e. cts:uri-match() in XQuery is cts.uriMatch() in 
> JavaScript.
> 
> Justin
> 
>> On Mar 31, 2017, at 3:31 AM, Andreas Felix  wrote:
>> 
>> Hi,
>> i need to fetch uris by wildcard, eg. foo*
>> In xquery i use the cts:uri-match function for this.
>> Does anybody know how so solve this with the Java-API?
>> 
>> Regards
>> Andreas
>> ___
>> General mailing list
>> 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

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


Re: [MarkLogic Dev General] How to use uri-match in the java api?

2017-03-31 Thread Justin Makeig


In general, the built-in functions map one-to-one between JavaScript and 
XQuery. (There are exceptions.) Because hyphens aren't friendly in JavaScript 
property names, we do a kabab-case to camel-case translation for all of the 
names in JavaScript, i.e. cts:uri-match() in XQuery is cts.uriMatch() in 
JavaScript.

Justin

> On Mar 31, 2017, at 3:31 AM, Andreas Felix  wrote:
> 
> Hi,
> i need to fetch uris by wildcard, eg. foo*
> In xquery i use the cts:uri-match function for this.
> Does anybody know how so solve this with the Java-API?
> 
> Regards
> Andreas
> ___
> General mailing list
> 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


Re: [MarkLogic Dev General] question about permissions

2017-03-31 Thread Gary Vidal
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