Nuxeo automation client

Hello I already saw the NXQL documentation and there are some questions that I have about it. I saw those two statements:

SELECT * FROM Document
SELECT * FROM Folder

Then I executed the next queries and I got the same result

SELECT * FROM File WHERE dc:title LIKE 'word1.pdf'
SELECT * FROM Document WHERE dc:title LIKE 'word1.pdf'

So, my question is What are the differences between Document and File? When should I use Document instead File and vice versa.

Also I saw this statement:

SELECT * FROM Note, File WHERE dc:title = 'My Doc'

What would be the equivalent meaning of that statement into normal sql? Will it be something like Select * from Note, File where Note.dc:title = 'My Doc' and File.dc:title = 'My Doc' ?

Thanks

0 votes

1 answers

1736 views

ANSWER



You will find the documentation about nuxeo document types here: Document types which explains the type system and the questioned distinction quite well.

Shortly, every type in Nuxeo is a subtype of Document, so if the only type that you stored so far was of type File, the returned result set will be the same.

As for this statement:

SELECT * FROM Note, File WHERE dc:title = 'My Doc'

it just returns all documents of either Note or File type, where the field dc:title equals 'My Doc'. This field is available in both types and this comes from the fact that these types contain the same schema called 'dublincore' (which is prefixed as 'dc'). That schema contains the field title. To relate to a specific field in a schema you use this syntax:

schema:field
0 votes



Thanks a lot Sulejman, I also saw you other answer in the old forum. All the information that you have given me has been very useful. I will put here the same question that I posted in the old forum, just in case someone checks this forum and not the oldone.

I already saw that there are some schemas defined inside Nuxeo's server (/nxserver/schemas) one of them is dublincore(defined in /nxserver/schema/dublincore.xsd), and it has several properties, like title, created, path …… This schema and its properties are similar to the table that Nuxeo creates in the database (I am using postgres), the table called dublincore and it has columns called, title, created, path…. So I am guessing that to have access to the column data from the table content I will have to use the schema content and the property data (defined in /nxserver/schema/core-types.xsd). The problem is that I don't know how to have access to that information.

so far I am executing the query "Select * from Document where dc:title like 'word1.pdf'" This query returns me several documents, that I am saving into a Documents object, then I go through all the documents and I extract them one by one into a Document object, then I use the Document to get the title and the path (Document.getTitle() and Document.getPath()) but I don't see how I can get the data property.

I know there is an on object called DocumentModel, this object has one method called getProperty(String schemaName, String name). I think I could use it to get what I want, DocumentModel.getProperty("content", "data"), but I don't know how to transform a Document into a DocumentModel. ANY SUGGESTION???????

Also I have tried to run queries like "Select dc:path from Document where dc:title like 'word1.pdf'" Is this possible??? but I don't get anything. when I run "Select * from Document where dc:title like 'word1.pdf'" I get the documents's id. I know that dc means dublincore, Do you know what would be the set of letters that represent content??????

Thanks in advance.

01/25/2012

If you have more question, create a new question. This is the idea of this forum. Please follow this recommendation for the community. And also, when you create an answer to a question, use it to answer and use comment to add a comment.

Thanks

03/14/2012