cancel
Showing results for 
Search instead for 
Did you mean: 

Querying Custom MetaData

dallinns
Champ on-the-rise
Champ on-the-rise
I have a custom type in Alfresco, for the time being it is "sc:mine". Each document of this type has a section property (sc:section). I have several documents that have "ENGL316001" specified as their value for the property sc:section. I want to do a query search to find all documents whose sc:section property is equal to "ENGL316001" but I can't figure out how to do this with Apache Chemistry and the Alfresco OpenCmis extension.

Currently with the following query I can find all documents of type sc:mine.

"select d.*,o.* from cmis:document as d join sc:mine as o on d.cmis:objectid = o.cmis:objectid"
But that is the closest I can get.

How do I specifically search for all sc:mine documents whose sc:section property is equal to "ENGL316001"?

This is the type definition for sc:mine

    <type name="sc:mine">
         <title>My Type</title>
         <parent>cm:content</parent>
         <properties>
            <property name="sc:section">
               <title>Section Number</title>
               <type>d:text</type>
            </property>
            <property name="sc:description">
               <title>Description</title>
               <type>d:text</type>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>cm:titled</aspect>
         </mandatory-aspects>
      </type>
3 REPLIES 3

rmcveigh
Champ in-the-making
Champ in-the-making
Without trying this myself why not do: 
select * from sc:mine where sc:section = 'ENGL316001'
-Ryan

dallinns
Champ on-the-rise
Champ on-the-rise
That actually worked, thanks. I guess I was making it too complicated.

rmcveigh
Champ in-the-making
Champ in-the-making
Sure thing, glad I could help. 

Generally if you look at a type's details from CMIS you'll see querynames and other interesting metadata.  I believe Alfresco returns query names to match the actual property names in your model, but this isn't guaranteed by the CMIS spec, so you'll want to interrogate the API to get query names.  Similarly you can get information like if a property can be used in an order by statement by checking the orderable field.

-Ryan