[Cubicweb] About SubjectRelation and RelationType differences

Sylvain Thénault sylvain.thenault at logilab.fr
Fri May 25 17:14:14 CEST 2012


On 25 mai 14:48, Nicolas Chauvat wrote:
> On Fri, May 25, 2012 at 02:20:50PM +0200, Stéphane Bugat wrote:
> > 
> > It is not clear to me from the CW documentation in which cases it is
> > better to use a SubjectRelation attribute or a RelationType relation
> > between two entities in my scheme.  As far as I understood,
> > SubjectRelation is more dedicated to "inlined" relations where both
> > entities are strongly correlated, whereas RelationType refers to
> > more complex types of relations where both entities may refer to
> > very different objects.  Although both of them seem to lead to the
> > same scheme, so maybe there is nothing to worry about...
> 
> yams knows about Entities and Relationships. SubjectRelation,
> RelationType and RelationDefinition are different ways to define the
> same thing: a Relation.

Though there is some subtilities...

RelationType defines only a semantic kind of relation, e.g. 'documented_by'.

RelationDefinition defines a 3-uple subject relation-type object, e.g. 'Project documented_by File'.

SubjectRelation is just a syntactic sugar for RelationDefinition.

Now, some yams properties such as inlined are common to all relations
of a given type, while some others are defined per definition.

Definition properties that are defined on a relation type means "force all 
relation definition to have this value for this property".

-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org



More information about the Cubicweb mailing list