Skip to main content
Jump to: navigation, search

Difference between revisions of "View-builder vocabulary"

(Displaying Slots)
(Displaying Slots)
Line 79: Line 79:
  
 
* '''A''' is defined in some context. This definition may be defined in a regular context, a template context, or an ontology context.
 
* '''A''' is defined in some context. This definition may be defined in a regular context, a template context, or an ontology context.
* The definition of '''A''' includes either:
+
* The definition of '''A''' must include a set of metadata attributes (as described in [[Persona Data Model 2.0#Attribute_Metadata | Attribute Metadata]] and in [[Higgins Data Model 2.0#Attribute_Definitions | Attribute Definitions]]) ...
** a set of metadata attributes (as described in [[Persona Data Model 2.0#Attribute_Metadata]] and in [[Higgins Data Model 2.0#Attribute_Definitions]])
+
* ...unless '''A''' is associated with a mapping rule (e.g. ''roleSameAs'' or others, see [[Mapping vocabulary]] for details) that is based on some other attribute '''B''' in which case the metadata attributes should be retrieved from '''B'''.
** or the special ''fp:baseAttribute'' metadata attribute (see [[Flat Persona vocabulary]]) which references some other attribute '''B''' which acts as the source of '''A''''s metadata attributes.
+
* Except in the case where A is mapped to some other attribute '''B''' via the ''roleSameAs'' mapping rule (see [[Mapping vocabulary]]). In this case the definition of '''B''' should be used as the source for '''A''''s metadata attributes.
+
  
 
== Example ==
 
== Example ==

Revision as of 12:22, 2 May 2012

{{#eclipseproject:technology.higgins|eclipse_custom_style.css}} Vocabulary to describe a view of a context. A view is a tree structure of groups of attributes to be displayed/edited. Part of the Persona Data Model 2.0.

Files

UML Overview

View-builder 2.0.0109.png

Classes

Group

A logical group of Slots and/or sub-Groups

  • subClassOf: ViewNode
  • 1..1 skos:prefLabel
  • 1..N child

MultiGroup

Similar to a regular Group, a MultiGroup is parent for a set of child Slots. Different from a Group, it also has an view-builder:attribute attriubte. Another difference is that a MultiGroup self-replicates such that there end up being N instances of itself--one for each of the N values of its attribute attribute. Each of these N values is an instance of p:Person (p1, p2, ... pN). The view-builder:attribute attributes of its child Slot should be evaluated within the scope of its parent p:Person p1..pN.

It is used in view that need to display a set of N "credit cards" (really p:Person nodes with p:Buyer roles), or a set of N "addresses" (really p:Person nodes).

  • subClassOf: Group
  • 1..1 attribute
  • 0..1 app-data:script

Slot

Metadata about how an attribute from the Persona vocabulary (or one of its imports) or from the Flat Persona vocabulary or from the rdf (e.g. rdf:class) should be presented.

  • subClassOf: ViewNode
  • 1..1 attribute
  • 0..1 app-data:script

ViewNode

(Abstract) A node in the view hierarchy

  • 1..1 displayOrder
  • 0..1 layout

Attributes

attribute

The attribute that should be displayed in this Slot, or the attribute to evaluate when handling a MultiGroup.

  • domain: Slot
  • value: rdf:Property

child

A child of a Group

  • domain: Group
  • value: ViewNode

displayOrder

A number that indicates the relative position with respect to the displayOrder of sibling objects with this same attribute. Lower numbers indicate precedence.

  • domain: Slot or Group
  • value: xsd:Integer

layout

An optional URL of an html/javascript template sub-page of a web app.

  • domain: ViewNode
  • value: URI

script

After the user edits a slot, this script should be executed. (e.g. to push the updated value to an external website).

  • domain: Slot
  • value: app-data:Push

Displaying Groups

Each Group MUST have a skos:prefLabel that describes the internationalized string label for the group.

A Group is a logical collection of Slots (and sub-groups). It is entirely up to the look & feel of the UI to determine how this grouping (and sub-grouping) is represented.

There is a special kind of (non-top level) Group called a MultiGroup. Unlike regular Groups it has (like a Slot) a view-builder:attribute. As described in the MultiGroup class above, a MultiGroup is a pattern that describes how its child Slots should be collected together into N groups. N is the number of values of the MultiGroup's view-builder:attribute attribute. This attribute's values are always p:Person instances. Each of these p:Person instances acts as a source of attribute/values for one of these N groups.

MultiGroups are used to display a set of attributes (e.g. credit card number, name, address, phone, etc.) for each of N p:Person entities.

Displaying Slots

Each Slot holds an attribute A:

  • A is defined in some context. This definition may be defined in a regular context, a template context, or an ontology context.
  • The definition of A must include a set of metadata attributes (as described in Attribute Metadata and in Attribute Definitions) ...
  • ...unless A is associated with a mapping rule (e.g. roleSameAs or others, see Mapping vocabulary for details) that is based on some other attribute B in which case the metadata attributes should be retrieved from B.

Example

Here is an example of a view-builder:

:AgeRange
     rdf:type view:Slot ;
     view:attribute fp:ageRange ;
     view:displayOrder 1 .

:DemographicsGroup
     rdf:type view:Group ;
     view:child :PostalCode , :AgeRange , :Gender ;
     view:displayOrder 1 ;
     skos:prefLabel "Demographics"^^xsd:string .

:Gender
     rdf:type view:Slot ;
     view:attribute fp:gender ;
     view:displayOrder 2 .

:Interest
     rdf:type view:Slot ;
     view:attribute p:like ;
     view:displayOrder 1 .

:InterestsGroup
     rdf:type view:Group ;
     view:child :Interest ;
     view:displayOrder 2 ;
     skos:prefLabel "Interests"^^xsd:string .

:PostalCode
     rdf:type view:Slot ;
     view:attribute fp:postalCode ;
     view:displayOrder 10 .

:ViewRoot
     rdf:type view:Group ;
     view:child :InterestsGroup , :DemographicsGroup ;
     view:displayOrder 1 ;
     skos:prefLabel "Advertising Profile"^^xsd:string .

The demographics group shown above has slots whose attributes, fp:gender, fp:ageRange, fp:postalCode, are all from the Flat Persona vocabulary.

The interests group shown above has a slot whose attribute is the complex valued attribute, online-behavior:interest. In this rather special case the presentation logic should render the name of the class of the instance (e.g. "Humor > Satire" or "World Destinations > Africa > East Africa > Nigeria") as opposed to rendering the value of an attribute of the instance as is done in the usual case.

A few additional notes on the above example

The FlatPersona namespace is only useful when either (a) there are not multiple entity values of the same attribute being requested, or, (b) there are just a few alternative entities and the "right" one can be figured out by matching using the role tags (e.g. "home" vCard entity vs. "work" vCard entity). Flattening, a simplification. It is an attempt to hide some complexity. But there are times when we can't hide the complexity. Multiple non-role-tagged entity values of an attribute is one of those times.

Displaying the "interests" of a user is a case where the flat persona approach won't work because a single p:Person node has a multi-valued (multi-entity-valued) "p:like" attribute. You'll notice in the view hierarchy under the interests Group there is a Slot whose view:attribute attribute whose value is p:like--a value that is from the persona vocabulary and NOT from the flat persona vocabulary. We have to get all of the values of this attribute. These values are (multiple) int:InterestTopic-class entities. The specific class of this InterestTopic might be "Satire", but of course we probably want to display something like "Humor > Satire" --in other words rendering not just the "leaf" class name but where it sits in relation to the (up to 6 levels) of super-classes ("Humor" being the super-class of "Satire" in this case).

Back to the top