PICS-NG Label Syntax Proposal

Ora Lassila, World Wide Web Consortium (W3C) & Nokia Research Center / Boston

Version 1, 2/20/97


Table of Contents

  1. PICS Labels as S-Expressions
  2. PICS Label Options
  3. Errors
  4. Syntax of "Primitive" Types
  5. Examples


This document is a suggestion for the new label syntax for PICS. It is intended as a starting point for discussion on the new PICS.

The mew syntax allows PICS labels to be parsed as standard s-expressions, without interpretation during the parsing process, and allows for a richer type system for rating values. This in turn will take PICS closer to a universal metadata communication mechanism.

[ NOTE: Currently, this document only gives a rather skeletal description of the new syntax and relies heavily on the PICS 1.1 specification. Later, it can be turned into a stand-alone document. ]

1. PICS Labels as S-Expressions

There are really several levels to describing the syntax of PICS labels. If we go with the basic definition that PICS labels are s-expressions, we can describe their syntax by giving the structure of the s-expressions we accept as valid PICS labels. This definition, however, will need clarifications as to the types of values accepted as components of the described structure. These clarifications are given in sections 3 and 4.

LabelManifest :: '(' Version OptionList Label* ')'
Version :: Symbol See Note 1.
OptionList :: '(' Option* ')'
Option :: OptionName Value See Section 2 for a description of Option structure.
OptionName :: Symbol See Note 2.
Label :: LabelList | PrimitiveLabel | Error
LabelList :: '(' 'list' OptionList Label* ')'
PrimitiveLabel :: '(' 'label' OptionList Attribute* ')'
Attribute :: AttributeName Value
AttributeName :: Symbol | URLString
URLString :: '"' URL '"'
Value :: String | Symbol | Boolean | Range | '(' Value* ')'
Range :: Number | '(' 'range' Number Number ')' See Notes 3 and 5.
Number :: NumberLiteral | '-inf' | '+inf'
Boolean :: 'true' | 'false' See note 5.
Error :: '(' 'error' ErrorType Value* ')' See Section 3 for a description of errors.
ErrorType :: Symbol See Note 4.

Notes

  1. In this version, the Version symbol is 'PICS-2.0'. See Section 4 for a description of the syntax of "primitive" types such as symbols, strings, etc.
  2. Only certain options are allowed, thus there are more restrictions to the OptionName definition than it just having to be a symbol. From the standpoint of parsing PICS labels as s-expressions these restrictions are not relevant.
  3. An alternative representation for ranges could be '[' Number Number ']'. If this representation is adopted the definition for Symbol (given later in this document) has to be changed.
  4. Only certain error types are allowed, thus there are more restrictions to the definition of ErrorType than it just having to be a symbol. From the standpoint of parsing PICS labels as s-expressions these restrictions are not relevant.
  5. The syntax description for Value does not actually require the definitions for Boolean and the complex version of Range, but they are included here to illustrate that certain symbols have predefined semantics in the new PICS system.

2. PICS Label Options

Options can be divided into three categories - document options, label options and other options - and their syntax can be defined in detail.

Option :: DocumentOption | LabelOption | OtherOption
DocumentOption :: 'at' ISODate |
'md5' Value
LabelOption :: 'by' String |
'generic' Boolean |
'for' URLString |
'on' ISODate |
'until' ISODate |
'name' Symbol |
'service' URLString |
'dsig' Value
OtherOption :: 'comment' String |
'full' URLString |
'extension' Extension
Extension :: '(' MandOpt URLString value* ')'
MandOpt :: 'mandatory' | 'optional'

Notes:

  1. Labels or label trees can be named using the name option.
  2. Service URLs no longer have a special syntactic position but are now an option called service.
  3. Missing from this description is the option signature-RSA-MD5. A new option dsig has been added.

3. Errors

Errors can be defined in more detail like this:

Error :: '(' 'error' ErrorBody ')'
ErrorBody :: NoRatingsError |
RequestDeniedError |
ServiceUnavailableError |
NotLabeledError
NoRatingsError :: 'no-ratings' String*
RequestDeniedError :: 'request-denied' [ DenialExplanation ]
DenialExplanation :: String* | '(' URL String* ')'
ServiceUnavailableError :: 'service-unavailable'
NotLabeledError :: 'not-labeled' URL*

4. Syntax of "Primitive" Types

Here are definitions for some of the "literal" entities of the syntax: 

Symbol any sequence of characters not containing whitespace nor any of the following characters: ( ) "
NumberLiteral defined as number in the PICS 1.1 spec.
String defined as quotedname in the PICS 1.1 spec.
URL as defined in the PICS Rating Services and Rating Systems.
ISODate a String, representing a date but restricted from the ISO standard, as described by the PICS 1.1 spec.

5. Examples

Here are some of the examples from the PICS 1.1 document, modified for the new syntax:

PICS 1.1

PICS NG

(PICS-1.1 "http://www.gcf.org/v2.5"
  by "John Doe"
  labels on "1994.11.05T08:15-0500"
         until "1995.12.31T23:59-0000"
         for "http://w3.org/PICS/Overview.html"
         ratings (suds 0.5 density 0 color/hue 1)
         for "http://w3.org/PICS/Underview.html"
         by "Jane Doe"
         ratings (subject 2 density 1 color/hue 1))
(PICS-2.0 (service "http://www.gcf.org/v2.5"
           by "John Doe")
  (label (on "1994.11.05T08:15-0500"
          until "1995.12.31T23:59-0000"
          for "http://w3/org/PICS/Overview.html")
    suds 0.5 density 0 color/hue 1)
  (label (for "http://w3/org/PICS/Underview.html"
          by "Jane Doe")
    subject 2 density 1 color/hue 1))
(PICS-1.1 "http://www.gcf.org/v2.5"
  l r (suds 0.5 density 0 color/hue 1)
    r (subject 2 density 1 color/hue 1))
(PICS-2.0 (service "http://www.gcf.org/v2.5")
  (label () suds 0.5 density 0 color/hue 1)
  (label () subject 2 density 1 color/hue 1))


Ora Lassila 2/20/97