POWDER is designed to allow a small amount of data to describe a large number of resources. An important step on this road is to be able to define a set of resources. If a candidate resource is an element of the set, then POWDER allows a processor to deduce RDF triples in which the candidate resource's URI is the subject.
The focus of this discussion document is how we define the sets, specifically, how we combine different statements from which set membership can be inferred.
For the purposes of this discussion we want to encode:
All resources on example.org and example.net where the path starts with foo or bar are described by http://www.example.org/description.
The RDF properties hasHost and pathStartsWith are among those being defined by the group.
There are several options. At present, the plan is to include them in a first public working draft and seek feedback. As there are so many options, we'd like to reduce the number a little before then if we can.
It's clear that none encode all the necessary information to determine whether a candidate resource is, or is not, an element of the set, i.e. the data will have a strcture that must be understood by a POWDER processor.
Multiple instances of the same property are combined with logical OR, different properties are combined with logical AND. Thus we would encode the example as:
<wdr:WDR> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.org</wdr:hasHost> <wdr:hasHost>example.net</wdr:hasHost> <wdr:pathStartsWith>foo</wdr:pathStartsWith> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
All properties of Set are combined with logical AND but we introduce a new property and class that allows properties to be combined with OR thus:
<wdr:WDR> <wdr:hasScope> <wdr:Set> <wdr:includes> <wdr:unionOf> <wdr:hasHost>example.org</wdr:hasHost> <wdr:hasHost>example.net</wdr:hasHost> </wdr:unionOf> </wdr:includes> <wdr:includes> <wdr:unionOf> <wdr:pathStartsWith>foo</wdr:pathStartsWith> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:unionOf> </wdr:includes> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
Properties are combined with logical AND but they take a white space separated list, members of which are combined with OR.
<wdr:WDR> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.org example.net</wdr:hasHost> <wdr:pathStartsWith>foo bar</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR> </rdf:RDF>
Allow multiple Scope statements in a DR and combine those with OR.
<wdr:WDR> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.org</wdr:hasHost> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.org</wdr:hasHost> <wdr:pathStartsWith>foo</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.net</wdr:hasHost> <wdr:pathStartsWith>foo</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasScope> <wdr:Set> <wdr:hasHost>example.net</wdr:hasHost> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
A variation on 4 with closed list of scope statements:
<wdr:WDR> <wdr:hasScope rdf:parseType="Collection"> <wdr:Set> <wdr:hasHost>example.org</wdr:hasHost> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:Set> <wdr:Set> <wdr:hasHost>example.org</wdr:hasHost> <wdr:pathStartsWith>foo</wdr:pathStartsWith> </wdr:Set> <wdr:Set> <wdr:hasHost>example.net</wdr:hasHost> <wdr:pathStartsWith>foo</wdr:pathStartsWith> </wdr:Set> <wdr:Set> <wdr:hasHost>example.net</wdr:hasHost> <wdr:pathStartsWith>bar</wdr:pathStartsWith> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
None of the above - just use the Regular Expression property hasURI. Options 1 - 4 all use properties that match a string against a component of a URI. The hasURI property matches a RegEx against the whole thing so we could write our example as
<wdr:WDR> <wdr:hasScope> <wdr:Set> <wdr:hasURI>^(([^:/?#]+):)?(//[^:/?#]+\.)*example\.(org|net)/(foo|bar)</wdr:hasURI> </wdr:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
RDF/XML, Graph not available
Use an XML literal instead. Something like:
<wdr:WDR> <wdr:hasScope rdf:parseType="Literal" xmlns:set="http://www.w3.org/2007/05/powder-set"> <set:Set> <set:host> <set:match name="example.org" type="endsWith" /> <set:match name="example.net" type="endsWith" /> <set:path> <set:match name="foo" type="startsWith" /> <set:match name="bar" type="startsWith" /> </set:path> </set:host> </set:Set> </wdr:hasScope> <wdr:hasDescription rdf:resource="http://www.example.org/description" /> </wdr:WDR>
example.org
OR example.net
than in, say, option 1. Also,
as this is XML, not RDF, you need a separate XML processor to extract the result, a different processing model etc. Maybe GRDDL could help here?Use RDF's native support for structured values (rdf:value).
RDF has support for situations where there is a 'main value' that then needs some sort of qualification. The classic example being a weight where the main value is the numerical weight and the structural element is the units. This might be useful to us here.
<wdr:Set> <wdr:hasHost rdf:parseType="Resource"> <rdf:value>example.org</rdf:value> <rdf:value>example.net</rdf:value> <wdr:combine>OR</wdr:combine> </wdr:hasHost> <wdr:pathStartsWith rdf:parseType="Resource"> <rdf:value>foo</rdf:value> <rdf:value>bar</rdf:value> <wdr:combine>OR</wdr:combine> </wdr:pathStartsWith> </wdr:Set>