CMIS query language; Queryname cmis:document - cmis

I have some problems with CMIS query language. I want to get all documents (table no important), which have some property. So I wrote Select my_property from cmis:document.
Unfortunately I get answer: 0 documents. But when I alter query to Select my_property from my_table. I get different answer.
Could you tell me why?

The reason is that the spec does not provide for it. Here is what the spec says about the "relational view projection" (source):
In each Virtual Table, a Virtual Column is implicitly defined for each
property defined in the Object-Type Definition AND for all properties
defined on ANY ancestor-type of the Object-Type but NOT defined in the
Object-Type definition.
So a given object-type can be queried for properties of ancestor types, but the spec makes no provision for querying an object-type for properties of descendent types, which is what you are trying to do.
Jeff

Related

Association without ReferenceVersionField

Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
About the error
I am currently getting the following error when trying to search for manufacturers using $criteria->addAssociation('myCustomEntity'):
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_manufacturer.myCustomEntity.product_manufacturer_version_id' in 'field list'
About the big picture
The use case is similar to the SeoUrl entity where there is a ‘foreign_key’ field which can have a relation to multiple entity types. My entity has not associations, but the other entities are extended to have an association to my entity. Just like the SeoUrl.
However, the DAL creates a query which uses the ‘product_manufacturer_version_id’ field, which does not exist on my custom entity…
Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
No, you must set a ReferenceVersionField when adding associations to the definition of a versionized entity. This is too deeply rooted in the basic principles of the data abstraction layer to work around.
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
You can change the storage name of the field. That is the name of the corresponding column within your database table. When you instantiate ReferenceVersionField you can use the second, optional argument to provide the storage name:
public function __construct(string $definition, ?string $storageName = null)
The storage name should be provided in snake case. The name of the object property for the field will then be derived from the storage name and converted to camel case. So given you provide my_version_custom_id for the storage name, the object property of the entity will be myVersionCustomId.
Your entity may have multiple associations to different entities, but if those entities are versionized your foreign key constraint has to be a combination of columns for both the foreign primary key as well as the foreign version id.

What is the semantics of UML's ReadVariableAction in BoUML?

ReadVariableAction activity action in BoUML allows to choose a class and its attribute and returns the attribute through creation of output pin (see figure below and BoUML documentation):
But what is the semantic of that action? What does ReadVariableAction operation actually return?
According to clause 16.9.3.1 Variable Action of The Unified Modeling Language Specification Version 2.5:
A VariableAction operates on a statically-specified Variable. The Variable must be one that is defined either by an Activity (see sub clause 15.2) or a StructuredActivityNode (see sub clause 16.11) containing the VariableAction.
Clause 15.2.2 Abstract Syntax below says that Variable subsets ownedMember, so the variable should be identifiable by name.
But BoUML neither allows creation of variables for an activity nor passing a name of a variable to ReadVariableAction.
It seems that I could use ReadVariableAction as shown below
But it's wrong model from UML's point of view.
The semantic of the read/write/clear/add/remove variable actions in BoUML is ... wrong !
Clearly I misunderstood that part when I added the activities in BoUML, I didn't read well the norm to understood that concerns variable of the activity or a structured activity node. So by error the 'variable' I allow to choose is an attribute of a class. An other consequence is you cannot define variables for an activity nor structured activity node.
Mea culpa
BoUML 7.10 is available and fix the problem

How to specify the return type of a method that returns a list of values in StarUML?

I have two classes (say Database and Record). In Database class, I have a method named getRecords() that returns a list of Record objects.
In Java, the above method can be written as:
List<Record> getRecords(){..}
In StarUML, while designing Class diagram, I tried giving
+getRecords() : Record[0..*]
But StarUML refused to create method like above. When I tried with the one below, it works
+getRecords() : ArrayList<Record>
But this is more specific to Java. I want to implement something like Record[0..*] in StarUML. Is it possible to write methods in such format or the Java style of return type is the only solution ?
I don't know why StarUML refuses to parse the text, but you can still create it via model.
Add the operation and call it getRecords()
Right-click on the operation (in diagram or model), and select Add > Parameter
Select parameter in Model Explorer (probably the parameter is already selected when you created it) and set the direction parameter to return. This is how UML represents return types.
(Configure the type, multiplicity, and anything else you need.)
Note that the default collection in UML is Set, so you should check isOrdered, as List is an ordered collection.

CMIS: How to look for all properties of a document type?

I'm trying to find out how to create a cmis query that returns the properties of a specific document. Not the values, just the property name and its type. For example: property "dateCreated" type "String".
You have to get the type definition of the document. It contains the property definitions, which provide the information you are looking for.
If you are using OpenCMIS, DotCMIS, or PortCMIS, you access the property definitions like this: doc.getType().getPropertyDefinitions()
See also https://chemistry.apache.org/docs/cmis-samples/samples/types/index.html and https://chemistry.apache.org/java/javadoc/org/apache/chemistry/opencmis/commons/definitions/PropertyDefinition.html

Linq to Sql using a non-column attribute property in Association attribute

I am trying to create an association between 2 linq to sql entities, say Entity A and Entity B.
A uses a non-column attribute property ( named BaseDocumentType ) and a column attribute in an Association for "ThisKey" and 2 column attributes for "OtherKey". The following is an example of my Association attribute definition...
[System.Data.Linq.Mapping.AssociationAttribute ( ... ThisKey = "BaseDocumentType, Column2" , OtherKey = "Column1,Column2" )]
When I run it I get the following error...
"Data member 'System.String BaseDocumentType' of type 'Library' is not part of the mapping for type 'A'. Is the member above the root of an inheritance hierarchy?"
How can I define the relationship using the non-column attribute property or how do I make this work?
Thanks.
The message is quite clear. LINQ to SQL translates statements to SQL and you tried to use a property that doesn't map to a column, so it can't be translated to SQL.
You'll have to retrieve the entities you want from the database then try to query them using LINQ to Objects, ie LINQ operations on the resulting lists or arrays. A better option is to rethink your design and find a way to retrieve only the data you need from the database and avoid processing the results on the client.
Linq to SQL in this case prevented you from doing something really dangerous. It could have retrieved all the data and process them using your non-column attribute but that would create an enormous performance hit. Some naive LINQ providers actually do just that. Imagine retrieving 1000 objects from the database only to find the two objects that match over this non-column attribute.

Resources