cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS custom type query

lukas
Champ in-the-making
Champ in-the-making
Hi

I want to create a CMIS query to get informations about a custom folder
So I tried the following:
SELECT * FROM em:eventfolder WHERE em:eventfolder.eventid='1000'

Unfortunately this select did not work.

my content model:

<type name="em:eventfolder">
                        <title>Event Folder</title>
                        <parent>cm:folder</parent>
                        <properties>
                                <property name="em:eventfolder.eventid">
                                        <type>d:text</type>
                                </property>
                                …

Thanks for your help

Lukas
8 REPLIES 8

rjohnson
Star Contributor
Star Contributor
If I remember correctly, your query should be something like:-


SELECT * FROM F:em:eventfolder WHERE P:em:eventfolder.eventid='1000'


You need to define what CMIS is looking at F = Folder, D = Document, P = property.

kaynezhang
World-Class Innovator
World-Class Innovator
There are several errors in you model definition and query:
1.Your property name should not include ".";
2.You should make your property searchable in property defintion;
3.You don't need to add prefix (such as F:,D:smileyhappy:before your type
And P is not for property but for Policy,and you don't need it in cmis query at all.

You can modify you model like this
<code>
      <type name="ca:eventfolder">
         <title>Event Folder</title>
        <parent>cm:folder</parent>
        <properties>
           <property name="ca:eventid">
              <type>d:text</type>
                        <index enabled="true">
                       <tokenised>false</tokenised>
                        </index>
           </property>
        </properties>
      </type>
<code>
and
Modify you query string like this  "SELECT * FROM ca:eventfolder ef WHERE ef.ca:eventid='1000'";

lukas
Champ in-the-making
Champ in-the-making
Thanks for your help
I have modified my content model according to your post.
But I'm still not able to query em:eventfolder
I have tested the query with the CMIS-Workbench
select * from em:eventfolder


Is there anything else to consider?

thanks

Lukas

kaynezhang
World-Class Innovator
World-Class Innovator
please paste your model definition here

lukas
Champ in-the-making
Champ in-the-making
I the meantime i found out that Select * From em:doc works
em:folder still does not work
I'm also not able to query Select em:docdocID from em:doc but Select cmis:name from em:doc works


<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="em:eventmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
   <description>ProjectModel</description>
   <author>…</author>
   <version>1.0</version>
<!– Imports are required to allow references to definitions in other models –>
   <imports>
<!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
<!– Introduction of new namespaces defined by this model –>
   <namespaces>
      <namespace uri="http://www.em.com/model/content/1.0" prefix="em"/>
   </namespaces>
   <types>
<!– Enterprise-wide generic document type –>
      <type name="em:emailfolder">
         <title>Email Archive</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="em:emailfolderemailid">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailfolderfrom">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailfolderto">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailfoldersubject">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>cm:titled</aspect>
         </mandatory-aspects>
      </type>
      <type name="em:email">
         <title>Email</title>
         <parent>cm:content</parent>
         <properties>
            <property name="em:emailemailid">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailsubject">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailfrom">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emailto">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:emaildate">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>cm:titled</aspect>
         </mandatory-aspects>
      </type>
      <type name="em:doc">
         <title>Project Document</title>
         <parent>cm:content</parent>
         <properties>
            <property name="em:doceventid">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docemailid">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docProjektleiter">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docdocID">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docSales">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAKlasse">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAJahr">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docmodifier">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docfileextension">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAKategorie">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docBeschreibung">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docMonat">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAStatus">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docGesamt">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docCreator">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docDokumentenklasse">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVeranstalterKonto">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docEinstufung">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docCreationDate">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAAufbau">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAAbbau">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAStart">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docVAEnde">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:docModified">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            
         </properties>
         <mandatory-aspects>
            <aspect>cm:titled</aspect>
         </mandatory-aspects>
      </type>
      <type name="em:eventfolder">
         <title>Event Folder</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="em:eventfoldereventid">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAKategorie">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderprojektleiter">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>&gt;
            <property name="em:eventfolderVAKlasse">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAStart">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAAufbau">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAAbbau">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAEnde">
               <type>d:datetime</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderSales">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderGesamt">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAMonat">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAJahr">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVeranstalterKonto">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>
            <property name="em:eventfolderVAStatus">
               <type>d:text</type><index enabled="true"><tokenised>false</tokenised></index>
            </property>            
         </properties>
         <mandatory-aspects>
            <aspect>cm:titled</aspect>
         </mandatory-aspects>
      </type>
   </types>
   
</model>


Thanks for your help

kaynezhang
World-Class Innovator
World-Class Innovator
It seems there is noting wrong with your model definition,have you tried to redeploy you model or rebuild your index?
I have deployed you model in my envionment,Both
 Select em:docdocID From em:doc and Select * from em:emailfolder 
work well

lukas
Champ in-the-making
Champ in-the-making
Thanks a lot for testing my model.
I have reinstalled Alfreco, now it works

kaynezhang
World-Class Innovator
World-Class Innovator
You are welcome ,good luck.