- From: Holger Knublauch <holger@topquadrant.com>
- Date: Thu, 05 Feb 2015 09:06:33 +1000
- To: public-data-shapes-wg@w3.org
On 2/5/2015 6:58, Karen Coyle wrote:
> Is there a related requirement that would assert min/max cardinality
> on subjects of a type, or within a targeted graph? - e.g. only one
> subject of type foaf:person per graph. This is a common requirement
> that we have in the DCMI work.
This sounds like a global constraint to me, e.g.
ex:AllowOnlyOnePerson
a ldom:GlobalConstraint ;
ldom:message "Only one instance of foaf:Person expected." ;
ldom:sparql """
ASK {
{
SELECT (COUNT(?person) AS ?count)
WHERE {
?person a foaf:Person .
}
}
FILTER (?count > 1) # flag an error if more than 1
instance exists
} """ .
If this is a recurring pattern, a template could be defined that would
be used as
ex:AllowOnlyOnePerson
a ldomx:AllowOnlyOneInstance ;
ldomx:type foaf:Person .
So the requirement is implicitly already written down by a combination
of other requirements:
https://www.w3.org/2014/data-shapes/wiki/Requirements#Global_Constraints
https://www.w3.org/2014/data-shapes/wiki/Requirements#Expressivity:_Aggregations
https://www.w3.org/2014/data-shapes/wiki/Requirements#Expressivity:_Literal_Value_Comparison
https://www.w3.org/2014/data-shapes/wiki/Requirements#Expressivity:_Basic_Graph_Patterns
I cannot tell whether this combination is sufficiently clear, but all
the lego pieces are there - assuming they all get implemented by the
standard.
Regards,
Holger
Received on Wednesday, 4 February 2015 23:07:13 UTC