Documentum dql for file location - dql

Is it possible to write dql query that will list all files with their location something like execute get_path for '06002bd78000616a' but for all files? I cannot find any solution.

I have managed to solve this by using Api script
%Collection%=readquery,c,SELECT * FROM documents
#$Loop %Collection%
%r_object_id% = get,c,%Collection%,r_object_id
%path%= getpath,c,%r_object_id%
#$EndLoop

Related

Marklogic - Delete Versioned Collections

I have around 43 million documents which is having the latest versioned document in LIVE collection and also have same versioned document in another version collection named as (/collection/versionNumber). I want to delete the versioned collections which is around 34 million. what is best approach to go for it to delete all in one go .
You could try using xdmp:collection-delete() to delete all documents in the collection in a single transaction.
If that doesn't work and it isn't able to delete in one shot, then I would look to utilize batch tools. For instance, a CoRB job.
An example job options file with properties needed, except for the XCC-CONNECTION-URI:
# Inline module to select all URIs from the collection
URIS-MODULE=INLINE-XQUERY|let $uris := cts:uris("",(),cts:collection-query("/collection/versionNumber")) return (count($uris), $uris)
# Inline module to delete the docs
PROCESS-MODULE=INLINE-XQUERY|declare variable $URI as xs:string external; xdmp:document-delete($URI)
THREAD-COUNT=10
I think your application is using DLS library for versioning. If yes, and if you never want any version to look into in future, then only delete the versioned documents. Use can use "dls:document-unmanage" API in that case.
Also, explore dls:purge and dls:document-purge before proceeding. I am not very sure of these two.
Anyways, even if it's not DLS, processing them in one go (single transaction) would not be a recommended way. Either process them in batches or set them all in different threads on task server through spawn.

find alfresco nodeRef without using luceneSearch

I have a js webscript who return a list of documents from a specific repository in Alfresco. i used the luceneSearch to get the nodeRef of the repository, this works fine.
The repository primary path is: /app:company_home/app:dictionary/cm:StarXpert_x0020_Workflow/cm:fichiers_x0020_JSON and i used the luceneSearch like this to get the nodeRef from the primary path
var nodes = search.luceneSearch("PATH:\"/app:company_home/app:dictionary/cm:StarXpert_x0020_Workflow/cm:fichiers_x0020_JSON//*\" AND TYPE:\"cm:content\"","#cm:name", true);
But when i execute my code in the server side, i have an error, that my webScript can't get the nodes from the path i took it. I searched and i found that the problem is an indexation problem on the server alfresco version.
So my question is: can us get a nodeRef from a primary path, whithout using luceneSearch?
Thanks for any help
If I understand the documentation, you can use other methods with the search root object. The xpathSearch seems interesting :
org.mozilla.javascript.Scriptable xpathSearch(String search)
Execute a XPath search
The selectNodes(String search) might be interesting too.

Which namespace for Math functions in SPARQL?

I'm currently developing a project in which I use AllegroGraph as graph database. AllegroGraph provides full support for SPARQL 1.1 Query and Update.
I'm trying to write a SPARQL query in which I need some math functions (such as square root and so on). The problem is that every namespace I found isn't working. For example, I tried to use the xpath namespace for the math functions (https://www.w3.org/2005/xpath-functions/math) in this way:
PREFIX func:<http://www.w3.org/2005/xpath-functions/math#>
SELECT ?res
WHERE {
BIND(func:sqrt(4) as ?res) .
}
but it doesn't work since I get the following error:
QUERY FAILED: URI function <http://www.w3.org/2005/xpath-functions/math#sqrt> is not defined
Can you help me to find a workaround please?
Thanks in advance!

CMIS QL get folder path using CONTAIN (ALL:)

I am having a problem retrieving the path of a folder which contains '(' and ')' when I do a query in CMIS.
how can i get the below working ?
SELECT cmis:path FROM cmis:folder WHERE IN_TREE('a53471aa-b447-4fdd-a451-4a2beb494226') AND CONTAINS('ALL:Tom_(Robot)')
So (Robot) that's causing not to find the path.
Any idea how I can make ( and ) as part of my query?
Solution to this problem is
SELECT cmis:path FROM cmis:folder WHERE IN_TREE('a53471aa-b447-4fdd-a451-4a2beb494226') AND CONTAINS('ALL:Tom_Robot')
By removing the brackets it returns me folder path, somehow it gives me the correct result, but I am still interested on other peoples opinion on this, this does not sound good to me, whether this is openCMIS issue or an Alfresco.

How to upload multiple files to a folder in xquery?

How can I upload multiple files to a folder in xquery ?
Are you trying to iterate through a directory on the filesystem and insert those files at some location in the db, like this?
for $e in xdmp:filesystem-directory('c:\my-files\')/dir:entry
let $file := xdmp:filesystem-file($e/dir:pathname)
let $dest-uri := concat('/dest-path/',$e/dir:filename)
where ($e/dir:type eq 'file')
return xdmp:document-insert($dest-uri,$file)
You should take a look at Information Studio. It provides a UI for loading and transforming content. One of the built-in “collectors” allows you to point at a file system directory and recursively load its contents. Information Studio automatically handles the directory traversal and breaking the load up into multiple transactions, among many other conveniences.

Resources