You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Karnakar Thallapalli <ka...@virtusa.com> on 2011/03/31 12:13:24 UTC

cmis search qurery parsing

Hi 

I want to perform a search on document 

String myType = "my:documentType";

 

// get the query name of cmis:objectId

ObjectType type = session.getTypeDefinition(myType);

PropertyDefinition<?> objectIdPropDef =
type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);

String objectIdQueryName = objectIdPropDef.getQueryName();

 

String queryString = "SELECT " + objectIdQueryName + " FROM " +
type.getQueryName();

 

// execute query

ItemIterable<QueryResult> results = session.query(queryString, false);

 

for (QueryResult qResult : results) {

   String objectId =
qResult.getPropertyValueByQueryName(objectIdQueryName);

   Document doc = (Document)
session.getObject(session.createObjectId(objectId));

}

 

 

Can any one elaborate  my:Type   here 


Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.

--------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of 
this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

--------------------------------------------------------------------------------------------

Re: cmis search qurery parsing

Posted by Florent Guillaume <fg...@nuxeo.com>.
If you want to search all documents, then use "cmis:document" instead
of "my:documentType". cmis:document is the base type for all
documents.

Florent

On Thu, Mar 31, 2011 at 1:40 PM, Karnakar Thallapalli
<ka...@virtusa.com> wrote:
> I want to search for a document by name. can u provide sample example on this
>
> Warm Regards,
>
> Karnakar Goud Thallapalli
> Senior Engineer
> Virtusa (India) Pvt Ltd.
> Sy No.115, Nanakramguda Village, Serilingampally Mandal,
> Ranga Reddy District, Hyderabad - 19, AP India
> Phone:  +91 40 44528000 Ext:  63207
>
>
>
> -----Original Message-----
> From: Florian Müller [mailto:florian.mueller@alfresco.com]
> Sent: Thursday, March 31, 2011 5:07 PM
> To: dev@chemistry.apache.org; Karnakar Thallapalli
> Subject: Re: cmis search qurery parsing
>
> What do you want to search? Documents or folders? All types or a specific one?
> Do you want to search by metadata or full text?
>
> The CMIS query language is similar to SQL. In SQL the FROM clause the defines the table, in CMIS it defines the object type.
>
>
> Florian
>
>
>
> On 31/03/2011 11:29, Karnakar Thallapalli wrote:
>> Basically am writing search function,for this I am referring to http://chemistry.apache.org/java/examples/example-process-query-results.html
>>
>> Here I don't understand my:documentType
>> I don't understand my:documentType here what it is exactly does?
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Florent Guillaume [mailto:fg@nuxeo.com]
>> Sent: Thursday, March 31, 2011 3:55 PM
>> To: dev@chemistry.apache.org
>> Cc: Karnakar Thallapalli
>> Subject: Re: cmis search qurery parsing
>>
>> We don't understand your question.
>> Please state:
>> 1. what you tried
>> 2. what you expected to get
>> 3. what result you obtained instead
>>
>> Or what you don't understand in the API or the documentation, or in
>> the CMIS domain model.
>>
>> Florent
>>
>> On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
>> <ka...@virtusa.com>  wrote:
>>> Hi
>>>
>>> I want to perform a search on document
>>>
>>> String myType = "my:documentType";
>>>
>>>
>>>
>>> // get the query name of cmis:objectId
>>>
>>> ObjectType type = session.getTypeDefinition(myType);
>>>
>>> PropertyDefinition<?>  objectIdPropDef =
>>> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>>>
>>> String objectIdQueryName = objectIdPropDef.getQueryName();
>>>
>>>
>>>
>>> String queryString = "SELECT " + objectIdQueryName + " FROM " +
>>> type.getQueryName();
>>>
>>>
>>>
>>> // execute query
>>>
>>> ItemIterable<QueryResult>  results = session.query(queryString, false);
>>>
>>>
>>>
>>> for (QueryResult qResult : results) {
>>>
>>>    String objectId =
>>> qResult.getPropertyValueByQueryName(objectIdQueryName);
>>>
>>>    Document doc = (Document)
>>> session.getObject(session.createObjectId(objectId));
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> Can any one elaborate  my:Type   here
>>>
>>>
>>> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>>>
>>> --------------------------------------------------------------------------------------------
>>>
>>> This message, including any attachments, contains confidential information
>>> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
>>> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>>>
>>> --------------------------------------------------------------------------------------------
>>>
>>
>>
>>
>
>
> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>
> --------------------------------------------------------------------------------------------
>
> This message, including any attachments, contains confidential information
> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>
> --------------------------------------------------------------------------------------------
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Re: cmis search qurery parsing

Posted by Florian Müller <fl...@alfresco.com>.
Here is a starting point:


String name = "example.txt";

ItemIterable<QueryResult> results = session.query("SELECT * FROM cmis:document WHERE cmis:name='" + name + "'", false);

for(QueryResult hit: results) {  
    for(PropertyData<?> property: hit.getProperties()) {

        String queryName = property.getQueryName();
        Object value = property.getFirstValue();

        System.out.println(queryName + ": " + value);
    }
    System.out.println("--------------------------------------");
}



On 31/03/2011 12:40, Karnakar Thallapalli wrote:
> I want to search for a document by name. can u provide sample example on this
> 
> Warm Regards,
> 
> Karnakar Goud Thallapalli
> Senior Engineer
> Virtusa (India) Pvt Ltd.
> Sy No.115, Nanakramguda Village, Serilingampally Mandal,
> Ranga Reddy District, Hyderabad - 19, AP India
> Phone:  +91 40 44528000 Ext:  63207
>        
> 
> 
> -----Original Message-----
> From: Florian Müller [mailto:florian.mueller@alfresco.com]
> Sent: Thursday, March 31, 2011 5:07 PM
> To: dev@chemistry.apache.org; Karnakar Thallapalli
> Subject: Re: cmis search qurery parsing
> 
> What do you want to search? Documents or folders? All types or a specific one?
> Do you want to search by metadata or full text?
> 
> The CMIS query language is similar to SQL. In SQL the FROM clause the defines the table, in CMIS it defines the object type.
> 
> 
> Florian
> 
> 
> 
> On 31/03/2011 11:29, Karnakar Thallapalli wrote:
>> Basically am writing search function,for this I am referring to http://chemistry.apache.org/java/examples/example-process-query-results.html
>>
>> Here I don't understand my:documentType
>> I don't understand my:documentType here what it is exactly does?
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Florent Guillaume [mailto:fg@nuxeo.com]
>> Sent: Thursday, March 31, 2011 3:55 PM
>> To: dev@chemistry.apache.org
>> Cc: Karnakar Thallapalli
>> Subject: Re: cmis search qurery parsing
>>
>> We don't understand your question.
>> Please state:
>> 1. what you tried
>> 2. what you expected to get
>> 3. what result you obtained instead
>>
>> Or what you don't understand in the API or the documentation, or in
>> the CMIS domain model.
>>
>> Florent
>>
>> On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
>> <ka...@virtusa.com>   wrote:
>>> Hi
>>>
>>> I want to perform a search on document
>>>
>>> String myType = "my:documentType";
>>>
>>>
>>>
>>> // get the query name of cmis:objectId
>>>
>>> ObjectType type = session.getTypeDefinition(myType);
>>>
>>> PropertyDefinition<?>   objectIdPropDef =
>>> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>>>
>>> String objectIdQueryName = objectIdPropDef.getQueryName();
>>>
>>>
>>>
>>> String queryString = "SELECT " + objectIdQueryName + " FROM " +
>>> type.getQueryName();
>>>
>>>
>>>
>>> // execute query
>>>
>>> ItemIterable<QueryResult>   results = session.query(queryString, false);
>>>
>>>
>>>
>>> for (QueryResult qResult : results) {
>>>
>>>     String objectId =
>>> qResult.getPropertyValueByQueryName(objectIdQueryName);
>>>
>>>     Document doc = (Document)
>>> session.getObject(session.createObjectId(objectId));
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> Can any one elaborate  my:Type   here
>>>
>>>
>>> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>>>
>>> --------------------------------------------------------------------------------------------
>>>
>>> This message, including any attachments, contains confidential information
>>> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
>>> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>>>
>>> --------------------------------------------------------------------------------------------
>>>
>>
>>
>>
> 
> 
> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
> 
> --------------------------------------------------------------------------------------------
> 
> This message, including any attachments, contains confidential information
> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
> 
> --------------------------------------------------------------------------------------------


RE: cmis search qurery parsing

Posted by Karnakar Thallapalli <ka...@virtusa.com>.
I want to search for a document by name. can u provide sample example on this 

Warm Regards,

Karnakar Goud Thallapalli
Senior Engineer 
Virtusa (India) Pvt Ltd.
Sy No.115, Nanakramguda Village, Serilingampally Mandal,
Ranga Reddy District, Hyderabad - 19, AP India
Phone:  +91 40 44528000 Ext:  63207
      


-----Original Message-----
From: Florian Müller [mailto:florian.mueller@alfresco.com] 
Sent: Thursday, March 31, 2011 5:07 PM
To: dev@chemistry.apache.org; Karnakar Thallapalli
Subject: Re: cmis search qurery parsing

What do you want to search? Documents or folders? All types or a specific one?
Do you want to search by metadata or full text?

The CMIS query language is similar to SQL. In SQL the FROM clause the defines the table, in CMIS it defines the object type.


Florian



On 31/03/2011 11:29, Karnakar Thallapalli wrote:
> Basically am writing search function,for this I am referring to http://chemistry.apache.org/java/examples/example-process-query-results.html
> 
> Here I don't understand my:documentType
> I don't understand my:documentType here what it is exactly does?
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Florent Guillaume [mailto:fg@nuxeo.com]
> Sent: Thursday, March 31, 2011 3:55 PM
> To: dev@chemistry.apache.org
> Cc: Karnakar Thallapalli
> Subject: Re: cmis search qurery parsing
> 
> We don't understand your question.
> Please state:
> 1. what you tried
> 2. what you expected to get
> 3. what result you obtained instead
> 
> Or what you don't understand in the API or the documentation, or in
> the CMIS domain model.
> 
> Florent
> 
> On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
> <ka...@virtusa.com>  wrote:
>> Hi
>>
>> I want to perform a search on document
>>
>> String myType = "my:documentType";
>>
>>
>>
>> // get the query name of cmis:objectId
>>
>> ObjectType type = session.getTypeDefinition(myType);
>>
>> PropertyDefinition<?>  objectIdPropDef =
>> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>>
>> String objectIdQueryName = objectIdPropDef.getQueryName();
>>
>>
>>
>> String queryString = "SELECT " + objectIdQueryName + " FROM " +
>> type.getQueryName();
>>
>>
>>
>> // execute query
>>
>> ItemIterable<QueryResult>  results = session.query(queryString, false);
>>
>>
>>
>> for (QueryResult qResult : results) {
>>
>>    String objectId =
>> qResult.getPropertyValueByQueryName(objectIdQueryName);
>>
>>    Document doc = (Document)
>> session.getObject(session.createObjectId(objectId));
>>
>> }
>>
>>
>>
>>
>>
>> Can any one elaborate  my:Type   here
>>
>>
>> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>>
>> --------------------------------------------------------------------------------------------
>>
>> This message, including any attachments, contains confidential information
>> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
>> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>>
>> --------------------------------------------------------------------------------------------
>>
> 
> 
> 


Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.

--------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of 
this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

--------------------------------------------------------------------------------------------

Re: cmis search qurery parsing

Posted by Florian Müller <fl...@alfresco.com>.
What do you want to search? Documents or folders? All types or a specific one?
Do you want to search by metadata or full text?

The CMIS query language is similar to SQL. In SQL the FROM clause the defines the table, in CMIS it defines the object type.


Florian



On 31/03/2011 11:29, Karnakar Thallapalli wrote:
> Basically am writing search function,for this I am referring to http://chemistry.apache.org/java/examples/example-process-query-results.html
> 
> Here I don't understand my:documentType
> I don't understand my:documentType here what it is exactly does?
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Florent Guillaume [mailto:fg@nuxeo.com]
> Sent: Thursday, March 31, 2011 3:55 PM
> To: dev@chemistry.apache.org
> Cc: Karnakar Thallapalli
> Subject: Re: cmis search qurery parsing
> 
> We don't understand your question.
> Please state:
> 1. what you tried
> 2. what you expected to get
> 3. what result you obtained instead
> 
> Or what you don't understand in the API or the documentation, or in
> the CMIS domain model.
> 
> Florent
> 
> On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
> <ka...@virtusa.com>  wrote:
>> Hi
>>
>> I want to perform a search on document
>>
>> String myType = "my:documentType";
>>
>>
>>
>> // get the query name of cmis:objectId
>>
>> ObjectType type = session.getTypeDefinition(myType);
>>
>> PropertyDefinition<?>  objectIdPropDef =
>> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>>
>> String objectIdQueryName = objectIdPropDef.getQueryName();
>>
>>
>>
>> String queryString = "SELECT " + objectIdQueryName + " FROM " +
>> type.getQueryName();
>>
>>
>>
>> // execute query
>>
>> ItemIterable<QueryResult>  results = session.query(queryString, false);
>>
>>
>>
>> for (QueryResult qResult : results) {
>>
>>    String objectId =
>> qResult.getPropertyValueByQueryName(objectIdQueryName);
>>
>>    Document doc = (Document)
>> session.getObject(session.createObjectId(objectId));
>>
>> }
>>
>>
>>
>>
>>
>> Can any one elaborate  my:Type   here
>>
>>
>> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>>
>> --------------------------------------------------------------------------------------------
>>
>> This message, including any attachments, contains confidential information
>> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
>> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>>
>> --------------------------------------------------------------------------------------------
>>
> 
> 
> 


RE: cmis search qurery parsing

Posted by Karnakar Thallapalli <ka...@virtusa.com>.
Basically am writing search function,for this I am referring to http://chemistry.apache.org/java/examples/example-process-query-results.html

Here I don't understand my:documentType
I don't understand my:documentType here what it is exactly does?

 




-----Original Message-----
From: Florent Guillaume [mailto:fg@nuxeo.com] 
Sent: Thursday, March 31, 2011 3:55 PM
To: dev@chemistry.apache.org
Cc: Karnakar Thallapalli
Subject: Re: cmis search qurery parsing

We don't understand your question.
Please state:
1. what you tried
2. what you expected to get
3. what result you obtained instead

Or what you don't understand in the API or the documentation, or in
the CMIS domain model.

Florent

On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
<ka...@virtusa.com> wrote:
> Hi
>
> I want to perform a search on document
>
> String myType = "my:documentType";
>
>
>
> // get the query name of cmis:objectId
>
> ObjectType type = session.getTypeDefinition(myType);
>
> PropertyDefinition<?> objectIdPropDef =
> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>
> String objectIdQueryName = objectIdPropDef.getQueryName();
>
>
>
> String queryString = "SELECT " + objectIdQueryName + " FROM " +
> type.getQueryName();
>
>
>
> // execute query
>
> ItemIterable<QueryResult> results = session.query(queryString, false);
>
>
>
> for (QueryResult qResult : results) {
>
>   String objectId =
> qResult.getPropertyValueByQueryName(objectIdQueryName);
>
>   Document doc = (Document)
> session.getObject(session.createObjectId(objectId));
>
> }
>
>
>
>
>
> Can any one elaborate  my:Type   here
>
>
> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>
> --------------------------------------------------------------------------------------------
>
> This message, including any attachments, contains confidential information
> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>
> --------------------------------------------------------------------------------------------
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.

--------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information 
intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of 
this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

--------------------------------------------------------------------------------------------

Re: cmis search qurery parsing

Posted by Florent Guillaume <fg...@nuxeo.com>.
We don't understand your question.
Please state:
1. what you tried
2. what you expected to get
3. what result you obtained instead

Or what you don't understand in the API or the documentation, or in
the CMIS domain model.

Florent

On Thu, Mar 31, 2011 at 12:13 PM, Karnakar Thallapalli
<ka...@virtusa.com> wrote:
> Hi
>
> I want to perform a search on document
>
> String myType = "my:documentType";
>
>
>
> // get the query name of cmis:objectId
>
> ObjectType type = session.getTypeDefinition(myType);
>
> PropertyDefinition<?> objectIdPropDef =
> type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);
>
> String objectIdQueryName = objectIdPropDef.getQueryName();
>
>
>
> String queryString = "SELECT " + objectIdQueryName + " FROM " +
> type.getQueryName();
>
>
>
> // execute query
>
> ItemIterable<QueryResult> results = session.query(queryString, false);
>
>
>
> for (QueryResult qResult : results) {
>
>   String objectId =
> qResult.getPropertyValueByQueryName(objectIdQueryName);
>
>   Document doc = (Document)
> session.getObject(session.createObjectId(objectId));
>
> }
>
>
>
>
>
> Can any one elaborate  my:Type   here
>
>
> Virtusa was recently ranked and featured in 2010 Deloitte Technology Fast 500, 2010 Global Services 100, IAOP's 2010 Global Outsourcing 100 sub-list and 2010 FinTech 100 among others.
>
> --------------------------------------------------------------------------------------------
>
> This message, including any attachments, contains confidential information
> intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of
> this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
>
> --------------------------------------------------------------------------------------------
>



-- 
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87