And finally... ---------------------------------------------------------------------- http://aliman.googlecode.com/svn/trunk/sodc/SoDC-0.2/constraints/index.html SoDC-CL -- A Language for Expressing Syntax Constraints on Graph-based (Meta)data 1. Introduction @@TODO SoDC-CL is a language for expressing application-specific syntax constraints over graph-based (meta)data. The two basic components of a SoDC-CL document are "graph profiles" and "resource description profiles" -- "resource profiles" for short. 2. Resource Profiles A resource profile is a set of constraints on the properties of a resource described in some graph. The following constraints can be expressed in a resource profile... (property cardinality constraints) exact cardinality -- the resource must have exactly n values for a given property minimum cardinality -- the resource must have at least n values for a given property maximum cardinality -- the resource must have at most n values for a given property (property value constraints) URI value -- the resource must have only URI values for a given property blank node value -- the resource must have only blank node values for a given property plain literal value (language optional) -- the resource must have only plain literal values for a given property plain literal value (language required) -- the resource must have only plain literal values with language tags for a given property TODO plain literal value (language optional, fixed) -- the resource must have only plain literal values for a given property, and where the plain literal has a language tag, it must take a given value TODO plain literal value (language required, fixed) -- the resource must have only plain literal values with a given language tag for a given property TODO typed literal value -- the resource must have only typed literal values for a given property TODO typed literal value (datatype fixed) -- the resource must have only typed literal values with a given datatype for a given property TODO XML literal value -- the resource must have only XML literal values for a given property (given property value constraints) TODO given URI value -- the resource must have a given URI value for a given property TODO given plain literal value -- the resource must have a given plain literal value for a given property TODO given typed literal value -- the resource must have a given typed literal value for a given property (referential integrity constraints) TODO URI value reference -- the URI value of a given property must also be the subject of another description within the same graph TODO blank node reference -- the blank node value of a given property must also be the subject of another description within the same graph TODO reference with profile -- the URI or blank node value of a given property must also be the subject of another description within the same graph, and the given profile must be specified in that description 3. Graph Profiles A graph profile is a set of constraints on a graph. The following constraints can be expressed... TODO the graph must describe exactly n resources TODO the graph must describe at least n resources TODO the graph must describe at most n resources TODO the graph must describe exactly n resources with resource profile p TODO the graph must describe at least n resources with resource profile p TODO the graph must describe at most n resources with resource profile p TODO all resources in the graph must have a resource profile TODO all resources in the graph must have resource profile p Those marked "TODO" have not yet been implemented in SoDC-CL. 4. SoDC-CL Language & Examples For convenience of implementation, the SoDC Constraints Language is defined as an XML language. The W3C XML Schema defining the language is at the link below... sodc-cl.xsd -- SoDC-CL Schema For example, the SoDC-CL document below defines two resource profiles. The first constrains a resource to have exactly one plain literal value for the dc:title property, and at least one URI value for the dc:creator property. The second constrains a resource to have at least one plain literal value for the foaf:name property... <?xml version="1.0" encoding="UTF-8"?> <constraints name="simple constraints" xmlns="http://purl.org/net/sodc/cl"> <profile uri="http://example.com/profile/simple#book"> <constraint property="http://purl.org/dc/elements/1.1/title"> <cardinality>1</cardinality> </constraint> <constraint property="http://purl.org/dc/elements/1.1/title"> <value> <plainliteral/> </value> </constraint> <constraint property="http://purl.org/dc/elements/1.1/creator"> <mincardinality>1</mincardinality> </constraint> <constraint property="http://purl.org/dc/elements/1.1/creator"> <value> <uri/> </value> </constraint> </profile> <profile uri="http://example.com/profile/simple#person"> <constraint property="http://xmlns.com/foaf/0.1/name"> <mincardinality>1</mincardinality> </constraint> <constraint property="http://xmlns.com/foaf/0.1/name"> <value> <plainliteral/> </value> </constraint> </profile> </constraints> Note that resource profiles are identified by URIs. This allows a profile to be applied to specific resources in a graph (see below). 5. Applying Resource Profiles in SoDC-XML A resource profile must of course be applied to specific resources in some graph. In other words, some information must be provided which can be used to determine which resources in some graph must match which resource profiles. The SoDC-XML syntax is designed to allow this information to be embedded in the graph, via the profile element. For example, the graph below has embedded profile information... <?xml version="1.0" encoding="UTF-8"?> <graph xmlns="http://purl.org/net/sodc/xml"> <resource> <uri>http://example.com/book#1</uri> <profile>http://example.com/profile/simple#book</profile> ... etc ... -- Tom Baker <[log in to unmask]>