webCOMAND

cQL Attributes

Attributes are objects that refer back to a given object.  In other words, if a Book references an Author, then the Book is considered an attribute of the Author.  Conversely, if an Author references a Book, then the Author is considered an attribute of the Book.

Simple diagram to illustrate example.

Attributes are often used to associate additional information with an object without making changes to the object's content type. In other words, they are assertions about an object that are made outside of the scope of the object's direct fields.

Queries

Attributes are so common and useful that COMAND queries have special syntax to access them.

@(Field)ContentType.ObjectField
  • @ - Denotes an attribute reference.
  • (Field) - Narrows the attribute scope to just attributes that reference the object through a specific field or chain of dot-notation fields.  If not provided, any field in the attribute that references the object will match. Field can be a single field or chain of dot-separated fields extending out from the attribute.
  • ContentType - The attribute's content type identifier.  If not provided, attributes of any content type will match.
  • .ObjectField - Optional dot-notation field(s) from the attribute object.

Examples

Given the scenario illustrated above, each example below will retrieve a collection of authors based on outside references to those authors.

cQL to get all authors referenced by any articles.

FROM Author WHERE @Article

cPath to also get all authors referenced by any articles.

[:Contact AND @Article]

cQL to get all authors that are the primary author of any articles.

FROM Author WHERE @(Author)Article

cQL to get all authors that contributed to any articles.

FROM Author WHERE @(Contributors)Article

cPath to get the author of a book based on the book's ISBN number.

[:Author AND @(Author)Book.ISBN='978-1491908129']

cPath to get all authors that contributed to articles with "CMS" in the title.

[:Author AND @(Contributors)Article.Title LIKE '%CMS%']
 

webCOMAND

In webCOMAND, attributes are displayed and managed in the Related Sidebar of Form View in the Content Manager.