Ryan Lee wrote:
> Thanks for writing this up, Chris, it's good to have some examples to
> put a face on things. I corrected some minor typos (attached)
Neglected to actually attach files; now see attached.
--
Ryan Lee ryanlee_at_w3.org
W3C Research Engineer +1.617.253.5327
http://simile.mit.edu/
_at_prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_at_prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
_at_prefix dc: <
http://purl.org/dc/elements/1.1/> .
_at_prefix dtype: <
http://www.w3.org/2001/XMLSchema#> .
_at_prefix : <www.doNotKnowYet.org/Style> .
# -----------------------------------------------
# About this document
<> rdfs:comment "Style Vocabulary" ;
dc:date "2004-09-16" ;
dc:format "RDF" ;
dc:identifier <> ;
.
# --------------------------------------------------------------
# Style Vocabulary
# --------------------------------------------------------------
#
# The style vocabulary is used for defineing how properties are displayed.
#
# The basic idea is to use
# - display styles for defining the general apperance (text or image)
# - style attributes to configure display styles
# - hooks to CSS for details like font size and colors
# - parts for adding additonal fixed content to the styles
# - RDFpath for linking styles to RDF schemata.
#
# Contents:
# 1. Display Styles
# 2. Display Styles Attributes
# 3. Fixed Content and Parts
# 4. CSS Style
# -----------------------------------------------
# 1. Display Style Vocabulary
# -----------------------------------------------
:DisplayStyle rdf:type rdfs:Class ;
rdfs:label "Display Style" ;
rdfs:comment "Style for displaying RDF data."
.
:styleDomain rdf:type rdf:Property ;
rdfs:label "style domain" ;
rdfs:comment "The style should be used for the specified properties." ;
rdfs:domain :DisplayStyle .
# rdfs:range rdf:Property or RDFpath expression
:attribute rdf:type rdf:Property ;
rdfs:label "display style attribute" ;
rdfs:comment "Display styles attributes are used to configurate display styles." .
:cssHook rdf:type rdf:Property ;
rdfs:label "CSS hook" ;
rdfs:comment "Name of a CSS style defining display details." ;
rdfs:domain :DisplayStyle .
# rdfs:range style:CSSstyle or CSS style name as literal
:group rdf:type rdf:Property ;
rdfs:label "style group" ;
rdfs:comment "Groups the styles together. This is needed for the cascading mechanims
if there are multiple styles for upper properties in the hirarchy,
e.g. provided by different sources/authors" ;
rdfs:domain :DisplayStyle .
# -----------------------------------------------
# Supported display styles
# -----------------------------------------------
:DisplayStyleText rdf:type rdfs:Class ;
rdfs:label "Display style text" ;
rdfs:comment "Displays only the property value as plain text.";
rdfs:subClassOf :DisplayStyle .
:DisplayStyleImage rdf:type rdfs:Class ;
rdfs:label "Display style image" ;
rdfs:comment "Displays a property value as an image. The value must be a reachable URL of the image.";
rdfs:subClassOf :DisplayStyle .
:DisplayStyleProperty rdf:type rdfs:Class ;
rdfs:label "Display style property" ;
rdfs:comment "Displays the label and the value for a given property as plain text";
rdfs:subClassOf :DisplayStyle .
:label rdf:type rdf:Property ;
rdfs:label "property" ;
rdfs:comment "Specifies a specific label to use instead of the standard rdfs:label." ;
rdfs:domain :Property .
:DisplayStyleBulletList rdf:type rdf:Class ;
rdfs:label "Bullet List" ;
rdfs:comment "Show all values as a list with bullets." ;
rdfs:subClassOf :DisplayStyle .
:DisplayStyleNumberedList rdf:type rdf:Class ;
rdfs:label "Numbered List" ;
rdfs:comment "Show all values as a numbered list." ;
rdfs:subClassOf :DisplayStyle .
:DisplayStyleTable rdf:type rdfs:Class ;
rdfs:label "Display style table" ;
rdfs:comment "Display a set of properties defined by a lens as a table.";
rdfs:subClassOf :DisplayStyle .
# -----------------------------------------------
# 3. Display Style Attributes
# -----------------------------------------------
# Display styles attributes are used to configurate display styles.
:DisplayStyleAttribute rdf:type rdfs:Class ;
rdfs:label "Display Style" ;
rdfs:comment "Display styles attributes are used to configurate display styles." .
# -----------------------------------------------
:ShowURI rdf:type :DisplayStyleAttribute ;
rdfs:label "Show URI" ;
rdfs:comment "Show the URI of the resource instead of the property value."
.
:ShowLabel rdf:type :DisplayStyleAttribute ;
rdfs:label "Show Label (default)" ;
rdfs:comment "Show the label of a resource instead of the URI.
Uses the lens:LabelLens for the class."
.
:DoNotShow rdf:type :DisplayStyleAttribute ;
rdfs:label "Do not show" ;
rdfs:comment "Doesn't show the property value. This might be usefull together with :displayBeforeValue the substitution of values."
.
:DoNotShowIfValueMissing rdf:type :DisplayStyleAttribute ;
rdfs:label "Do not show" ;
rdfs:comment "Show nothing if the property value is unknown."
.
:UnknownValueMessage rdf:type :DisplayStyleAttribute ;
rdfs:label "Unknown value message" ;
rdfs:comment "Shows a unkown value message if the property value is unknown."
.
# -----------------------------------------------
:DisplayAsLink rdf:type :DisplayStyleAttribute ;
rdfs:label "Display as Link" ;
rdfs:comment "Display a property value as a link to the RDF resource."
.
:DisplayAsLinkInNewWindow rdf:type :DisplayStyleAttribute ;
rdfs:label "Display as link in a new browser window" ;
rdfs:comment "Display as link in a new browser window."
.
:DisplayAsExternalLink rdf:type :DisplayStyleAttribute ;
rdfs:label "Display as external link" ;
rdfs:comment "Display a URL as normal link and leaves it to the HTML browser to display the target resource."
.
:DisplayAsExternalLinkInNewWindow rdf:type :DisplayStyleAttribute ;
rdfs:label "Display as external link in new window" ;
rdfs:comment "Display a URL as normal link and leaves it to the HTML browser to display the target resource using a new window."
.
# -----------------------------------------------
:SingleValue rdf:type :DisplayStyleAttribute ;
rdfs:label "Single Value" ;
rdfs:comment "Displays only the first property value if there are several."
.
:MultiValue rdf:type :DisplayStyleAttribute ;
rdfs:label "Multi Value" ;
rdfs:comment "Displays all property values if there are several. (default)"
.
:SingleLine rdf:type :DisplayStyleAttribute ;
rdfs:label "Single Line" ;
rdfs:comment "Multiple property values are shown on a single line. (default)"
.
:MultiLine rdf:type :DisplayStyleAttribute ;
rdfs:label "Multi Line" ;
rdfs:comment "Multiple property values are shown on sperate lines."
.
# -----------------------------------------------
:SortASC rdf:type :DisplayStyleAttribute ;
rdfs:label "Sort ASC" ;
rdfs:comment "Sorts property values ASC."
.
:SortDESC rdf:type :DisplayStyleAttribute ;
rdfs:label "Sort ASC" ;
rdfs:comment "Sorts property values DESC."
.
# -----------------------------------------------
# 3. Adding Fixed Content
# -----------------------------------------------
# Parts allow you to add fixed content like pictures or text before or after property values.
# Do you like this?
:displayBeforeValue rdf:type rdf:Property ;
rdfs:label "display before value" ;
rdfs:comment "Fixed content, which should be displayed before the property value." ;
rdfs:domain :DisplayStyle;
# rdfs:range rdf:Seq or style:Part
.
:displayBeforeAllValues rdf:type rdf:Property ;
rdfs:label "display before all values" ;
rdfs:comment "Fixed content, which should be displayed before all property values." ;
rdfs:domain :DisplayStyle;
# rdfs:range rdf:Seq or style:Part
.
:displayAfterValue rdf:type rdf:Property ;
rdfs:label "display after value" ;
rdfs:comment "Fixed content, which should be displayed after the property value." ;
rdfs:domain :DisplayStyle;
# rdfs:range rdf:Seq or style:Part
.
:displayAfterAllValues rdf:type rdf:Property ;
rdfs:label "display after all values" ;
rdfs:comment "Fixed content, which should be displayed after all property values." ;
rdfs:domain :DisplayStyle;
# rdfs:range rdf:Seq or style:Part
.
# -----------------------------------------------
# Parts (Todo: Change Term to something better.)
# -----------------------------------------------
:Part rdf:type rdfs:Class ;
rdfs:label "Part" ;
rdfs:comment "A part is some fixed content. Todo: Change Term to something better."
.
:TextPart rdf:type rdfs:Class ;
rdfs:label "Fixed Text Part" ;
rdfs:comment "Part which displays a fixed text.";
rdfs:subClassOf :Part
.
:text rdf:type rdf:Property ;
rdfs:label "text" ;
rdfs:comment "Text to be displayed."
.
:ImagePart rdf:type rdfs:Class ;
rdfs:label "Fixed Image" ;
rdfs:subClassOf :Part ;
rdfs:comment "Part which displays a fixed image." .
:imageUrl rdf:type rdf:Property ;
rdfs:label "image URL" ;
rdfs:comment "URL of the image to be displayed."
.
:Line rdf:type rdfs:Class ;
rdfs:label "Line" ;
rdfs:comment "Part for displaying a horizontal line.";
rdfs:subClassOf :Part .
# -----------------------------------------------
# 4. CSS Style
# -----------------------------------------------
# CssStyles can be used to define display details like font and color.
# An alternative approach is leaving the style definition to a central
# CSS style sheet added by the rendering engine. In this case only style
# names are provided.
:CssStyle rdf:type rdfs:Class ;
rdfs:label "CSS Style" ;
.
:styleName rdf:type rdf:Property ;
rdfs:label "CSS Style Name" ;
rdfs:comment "Name of the CSS style." ;
rdfs:range :CssStyle
.
:styleDefinition rdf:type rdf:Property ;
rdfs:label "CSS Style definition" ;
rdfs:comment "CSS definition of the style." ;
rdfs:range :CssStyle
.
_at_prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_at_prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
_at_prefix dc: <
http://purl.org/dc/elements/1.1/> .
_at_prefix dtype: <
http://www.w3.org/2001/XMLSchema#> .
# Lens Namespace
_at_prefix : <
http://www.doNotKnowYet.org/Lens/> .
# -----------------------------------------------
# About this document
<> rdfs:comment "Lens Vocabulary (0.1)" ;
dc:description "Vocabulary for defining and relating lenses on RDF resources." ;
dc:date "2004-09-17" ;
dc:format "RDF" ;
dc:identifier <> ;
.
# --------------------------------------------------------------
# Lens Vocabulary (0.1)
# --------------------------------------------------------------
#
# The lens vocabulary is used for defining which properties of an
# RDF resources are displayed.
#
# It also allows you to relate lenses, e.g. a general and a more detailed
# lens for instances of the same class. This informtion can be used by a
# browser to selecting lenses or for offering display options to the user.
#
# For specifying the actual appearance of an RDF resource the lens vocabulary
# is combined with a style vocabulary.
#
# Contents:
# 1. Lens Vocabulary
# 2. Lens Relation Vocabulary
# 3. Property Vocabulary
# -----------------------------------------------
# 1. Lens Vocabulary
# -----------------------------------------------
:Lens rdf:type rdfs:Class ;
rdfs:label "Lens" ;
rdfs:comment "A lens defines a view on a resource by defining which properties of the resource should be displayed."
.
:showProperties rdf:type rdf:Property ;
rdfs:label "show properties" ;
rdfs:comment "Sequence of all properties which should be shown." ;
rdfs:domain :Lens
# rdfs:range rdf:Seq or rdf:Property or RDFPath expression
.
:lensDomain rdf:type rdf:Property ;
rdfs:label "useable for" ;
rdfs:comment "The lens is usable for the specified class and it's subclasses." ;
rdfs:domain :Lens;
rdfs:range rdf:Class .
# -----------------------------------------------
# Special purpose lenses
# -----------------------------------------------
:StandardLens rdf:type rdfs:Class ;
rdfs:label "Standard Lens" ;
rdfs:comment "This lens should be used to display the instance if nothing else if known." ;
rdfs:subClassOf :Lens
.
:LabelLens rdf:type rdfs:Class ;
rdfs:label "Label Lens" ;
rdfs:comment "Lens for displaying the label of a resource ." ;
rdfs:subClassOf :Lens .
# -----------------------------------------------
# 2. Lens Relation Vocabulary
# -----------------------------------------------
:additionalInformationFor rdf:type rdf:Property ;
rdfs:label "additional information for" ;
rdfs:comment "The lens provides additional information for another lens. It's a good idea to display both lenses together." ;
rdfs:domain :Lens ;
rdfs:range rdf:Lens .
:moreDetailsFor rdf:type rdf:Property ;
rdfs:label "more details for" ;
rdfs:comment "The lens provides more details about an instance than the nother lens. Good for drill-down." ;
rdfs:domain :Lens;
rdfs:range rdf:Lens .
# -----------------------------------------------
# 3. Lens Property
# -----------------------------------------------
# More detailed description of a property, e.g. for specifing a sublens or necessary closures.
:Property rdf:type rdfs:Class ;
rdfs:label "Lens Property" ;
rdfs:comment "More detailed description of the property, e.g. for specifing sublens or closure." .
:property rdf:type rdf:Property ;
rdfs:label "property" ;
rdfs:comment "RDF property." ;
rdfs:domain :Property
# rdfs:range rdf:Property or RDFPath expression
.
:sublens rdf:type rdf:Property ;
rdfs:label "sublens" ;
rdfs:comment "Sublens which should be used for displaying property values." ;
rdfs:domain :Property ;
rdfs:range :Lens
.
:closure rdf:type rdf:Property ;
rdfs:label "closure" ;
rdfs:comment "Closure if lenses are recursively used." ;
rdfs:domain :Property ;
rdfs:range rdf:Literal
.
_at_prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_at_prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
_at_prefix dc: <
http://purl.org/dc/elements/1.1/> .
_at_prefix dtype: <
http://www.w3.org/2001/XMLSchema#> .
_at_prefix foaf: <
http://xmlns.com/foaf/0.1/> .
_at_prefix owl: <
http://www.w3.org/2002/07/owl#> .
_at_prefix vCard: <
http://www.w3.org/2001/vcard-rdf/3.0#> .
_at_prefix lens: <
http://www.doNotKnowYet.org/Lens/> .
_at_prefix style: <
http://www.doNotKnowYet.org/Style/> .
_at_prefix : <
http://www.doNotKnowYet.org/FOAFexample> .
# -----------------------------------------------
# About this document
<> rdfs:comment "Lenses and Styles for foaf:Person." ;
dc:date "2004-09-16" ;
dc:format "RDF" ;
dc:identifier <> ;
.
# Contents:
# 1. Lenses for foaf:Person
# 1.1. Standard Lenses
# 1.2. Identification and Type Lens
# 1.3. Contact Lens
# 1.4. Persons' Projects Lens
# 1.5. Project Lens
# 1.6. Knows Lens
# 2. Styles
# -----------------------------------------------
# 1.1. Standard Lenses for FOAF Person
# -----------------------------------------------
:StandardLens rdf:type lens:StandardLens ;
rdfs:label "Standard Lens for FOAF persons" ;
lens:lensDomain foaf:Person ;
lens:showProperties [ rdf:type rdf:Seq ;
rdf:_1 foaf:name ;
rdf:_2 foaf:surname ;
rdf:_3 foaf:depiction ] .
:ExtendedStandardLens rdf:type lens:Lens ;
rdfs:label "Lens which extends the standard Lens for FOAF person with some properties (good for drill down)" ;
lens:lensDomain foaf:Person ;
lens:moreDetailsFor :StandardLens ;
lens:showProperties [ rdf:type rdf:Seq ;
rdf:_1 foaf:name ;
rdf:_2 foaf:surname ;
rdf:_3 foaf:mbox ;
rdf:_4 foaf:homepage ;
rdf:_5 foaf:depiction ;] .
:PersonLabelLens rdf:type :LabelLens ;
rdfs:label "Lens labelling FOAF persons" ;
lens:lensDomain foaf:Person ;
lens:showProperties foaf:name .
# -----------------------------------------------
# 1.2. Identification and Type Lens
# -----------------------------------------------
:IdentificationLens rdf:type lens:Lens ;
rdfs:label "Identification and Type Lens for FOAF Persons" ;
lens:lensDomain foaf:Person ;
lens:additionalInformationFor :StandardLens ;
lens:showProperties [ rdf:type rdf:Seq ;
rdf:_1 foaf:mbox ;
rdf:_2 foaf:mbox_sha1sum ;
rdf:_3 owl:sameAs ;
rdf:_4 rdf:type ] .
# -----------------------------------------------
# 1.3. Contact Information Lens
# -----------------------------------------------
:ContactLens rdf:type lens:Lens ;
rdfs:label "Contact Information Lens" ;
lens:lensDomain foaf:Person ;
lens:additionalInformationFor :StandardLens ;
lens:showProperties [ rdf:type rdf:Seq ;
rdf:_1 foaf:homepage ;
# Use a RDFpath condition to show only private numbers
rdf:_2 "_at_vCard:TEL [ * [ @rdf:type=<
http://www.w3.org/2001/vcard-rdf/3.0#home> ]" ;
# Use a sublens to show addresses
rdf:_3 [ lens:property :vCardAddress ;
lens:sublens :vCardAddressLens ;
] ;
# Different approach using an RDFpath path
rdf:_4 "_at_vCard:vCardAddress/vCard:ADR/_at_vCard:Street" ;
rdf:_5 "_at_vCard:vCardAddress/*/_at_vCard:Country" ;
] .
# -----------------------------------------------
# vCard Address SubLens
# -----------------------------------------------
:vCardAddressLens rdf:type lens:StandardLens ;
rdfs:label "vCard Address Lens" ;
lens:lensDomain vCard:ADR ;
lens:showProperties [ rdf:type rdf:Seq;
rdf:_1 vCard:Street ;
rdf:_2 vCard:Pcode ;
rdf:_3 vCard:Locality ;
rdf:_4 vCard:Country ] .
# -----------------------------------------------
# 1.4. Persons' Projects Lens
# -----------------------------------------------
:PersonsProjectsLens rdf:type lens:Lens ;
rdfs:label "Persons' Projects Lens" ;
lens:lensDomain foaf:Person ;
lens:additionalInformationFor :StandardLens ;
lens:showProperties [ rdf:type lens:Property ;
# Show the values of two poperties together using RDFpath (e.g. for ordering the values)
lens:property "_at_foaf:currentProject && @foaf:pastProject" ;
lens:sublens :ProjectsLens ;
] .
# -----------------------------------------------
# 1.5. Project Lens
# -----------------------------------------------
:ProjectsLens rdf:type lens:StandardLens ;
rdfs:label "Projects Lens" ;
lens:lensDomain foaf:Project ;
lens:showProperties [ rdf:type rdf:Seq ;
rdf:_1 foaf:name ;
rdf:_2 dc:description ;
# Use alternative property if first property is missing.
# Or we leave this to the interence layer, as David proposes
rdf:_3 "_at_foaf:homepage || @foaf:workInfoHomepage";
] .
# -----------------------------------------------
# 1.6. Knows Lens
# -----------------------------------------------
:KnowsLens rdf:type lens:Lens ;
rdfs:label "Knows Lens" ;
lens:lensDomain foaf:Person ;
lens:additionalInformationFor :StandardLens ;
lens:showProperties [ rdf:type lens:Property ;
lens:property foaf:knows ;
lens:sublens :StandardLens ;
lens:closure "1" ] .
# -----------------------------------------------
# 2. Styles
# -----------------------------------------------
:StandardStyle rdf:type style:DisplayStyleProperty ;
rdfs:comment "Root style for all properties. Used if nothing else is specified.";
:styleDomain rdf:Property ;
style:cssHook "StandardTextCssStyle" ;
style:attribute style:ShowLabel ;
style:attribute style:DisplayAsLink ;
style:attribute style:MultiValue ;
style:attribute style:MultiLine ;
style:group :FOAFStyles .
# -----------------------------------------------
# FOAF standard stlye inheriting from the general standard style above
# -----------------------------------------------
:StandardStyleForFoaf rdf:type style:DisplayStyleProperty ;
# RDFpath expression using the function startsWith() to select all properties in the FOAF namespace
:styleDomain "_at_startsWith('
http://xmlns.com/foaf/0.1/')" ;
rdfs:comment "Standard style for all FOAF properties, if nothing else is specified.";
style:cssHook "StandardFOAFTextCssStyle" ;
style:group :FOAFStyles .
# -----------------------------------------------
# Styles for several specific FOAF properties
# -----------------------------------------------
:FOAFImageStyle rdf:type style:DisplayStyleImage ;
:styleDomain foaf:depict ;
rdfs:comment "Style for the FOAF depict property.";
style:attribute style:SingleValue ;
style:cssHook "ImageBorderCssStyle" ;
style:group :FOAFStyles .
:FOAFBulletList rdf:type style:DisplayStyleBulletList ;
:styleDomain foaf:homepage ;
:styleDomain foaf:workHomepage ;
:styleDomain foaf:mbox ;
rdfs:comment "Standard style for all FOAF bullet lists.";
style:attribute style:SortDESC ;
style:cssHook "FOAFListCssStyle" ;
style:group :FOAFStyles .
:PrivateTelStyle rdf:type style:DisplayStyleProperty ;
:styleDomain "_at_vCard:TEL [ * [ @rdf:type=<
http://www.w3.org/2001/vcard-rdf/3.0#home> ]" ;
# overwrite the standard label
:label "Private telephone number: " ;
style:attribute style:SingleValue ;
style:cssHook "RedTextCssStyle" ;
style:group :FOAFStyles .
# -----------------------------------------------
# Substitution example
# -----------------------------------------------
# rdf:type foaf:person is substituted with an image.
:TypeImageSubstitution rdf:type style:DisplayStyleProperty ;
:styleDomain "rdf:type [_at_rdf:type=<
http://xmlns.com/foaf/0.1/Person> ]" ;
style:attribute style:DoNotShow ;
style:displayBeforeValue [ rdf:type style:ImagePart ;
style:imageUrl <
http://www.example.org/PersonIcon.gif> ] ;
style:group :FOAFStyles .
# -----------------------------------------------
# Table style example
# -----------------------------------------------
# Display a person's projects as a table
# Projects are only displayed as a table, if they are linked to a person
# and the person is currently displayed as parent resource.
# The columns of the table are speficied by the "lens:sublens :ProjectsLens" definition in :ProjectsLens.
# Is this getting to complicated?
:ProjectTableStyle rdf:type style:DisplayStyleTable ;
:styleDomain "foaf:Person/_at_foaf:currentProject/foaf:Project" ;
:styleDomain "foaf:Person/_at_foaf:pastProject/foaf:Project" .
# Specifies fixed elements that should be added when displaying related persons.
# Fixed elements:
# 1. The header: "Knows the following persons :"
# 2. A line before each person.
# The attributes of the related persons are specified by :StandardLens.
# -----------------------------------------------
# Adding fixed elements example
# -----------------------------------------------
:FOAFKnowsLayout rdf:type style:DisplayStyle ;
style:styleDomain foaf:knows ;
rdfs:comment "Some fixed elements that should be added when displaying related persons.";
style:displayBeforeAllValues [ rdf:type style:TextPart ;
style:text "Knows the following persons :" ;
style:cssHook "HeaderStyle" ] ;
style:displayBeforeValue style:Line ;
style:group :FOAFStyles .
Received on Wed Sep 22 2004 - 20:55:43 EDT