PICS/DSig Standard Library
PICS Design Document
The w3c.pics.parser package can be used independantly of the rest of the code,
if all that is desired is a PICS parser/evaluator (if DSig is not needed).
In order to use the PICS code by itself, you need only to do the following:
Information about running the PICS portion of the library stand-alone is
included on the documentation page. Below is a brief description of the main classes:
- Create a new w3c/pics/parser directory tree.
- Copy all of the w3c.pics.parser source files except: Label.java, DSigDemo.java, DSigParser.*
- Change the name of NonDSigLabel.java to Label.java.
- Compile Label.java
In each of the three main classes (Label, Service, and Profile), calling the
method toString() will produce a valid PICS 1.1 representation of the object.
This output may be more verbose than the input which created the object.
A few examples of this behavior:
- PICS Label Classes:
- Label -- A Java representation of a PICS 1.1 label.
- Rating -- An object containing the ratings values for a single category.
- PICS Service Description Classes:
- Service -- A Java representation of a PICS 1.1 service description
(aka .rat file)
- Category -- An object containing all the information for a particular
- Enum -- An object containing information for a labeled (enumerated) value
within a category definition.
- PICS Profile Classes:
- Profile -- A Java representation of a PICSRules 1.1 profile.
- Policy -- An object containing a PICSRules Policy clause.
- When parsing labels, the LabelParser distributes category-options
from a category to its children, rather than just leaving it at the parent
- All true boolean options in a label (which do not have to actually specify
a value in the label), explicitly print out their value:
- In a Profile, the name of a primary attribute is always printed, even
though it is not necessary.
- The ProfileParser attempts to convert all single-quoted strings into
double-quoted strings. It will not do so if there exist any double quotes
within the single-quoted string.
There are three parsers in this package: LabelParser, ServiceParser, and
ProfileParser. Each may be run from the command-line if supplied with an
argument (the name of the file to parse). There is also PICSParser, which is
a Java console application that provides an interface to the three parsers.
The PICSParser also provides the means to evaluate profiles against label
lists, and to generate canonicalized PICS labels. Note that there is
another parser file: DSigParser. It cannot be run by itself. It is called
during the normal operation of the DSig code.
The parsers were built by constructing modified BNF implementations of each
data type and running them through Sun Microsystems' JavaCC, the Java
Compiler Compiler. The ProfileParser also made use of JJTree, a companion
tool to JavaCC, that is used to construct parse trees. The parse tree is
used to perform evaluation of PICS labels against a profile. Neither JavaCC
nor JJTree are necessary in order to use these parsers. They are required if
you wish to modify the grammars however (the grammar files are included in
the source distribution of the PICS/DSig Standard Library).
15 May 98