hxl-team / HXLator

PHP-based version of the HXLator
6 stars 2 forks source link

Proposed solution for the Age Cateogry titles problem #55

Closed cjhendrix closed 12 years ago

cjhendrix commented 12 years ago

We had decided to re-title the hxl:AgeGroups to include the source (ie: changing "Ages 0 to 4" to "Ages 0 to 4 (UNHCR Default Age Categories)".

However, after looking at it, we already have the source in the form of the title of the hxl:AgeGroupSet. For those places where we need to distinguish between similarly named AgeGroups in different AgeGroupSets, couldn't we just query the title of the AgeGroupSet?

vpcom commented 12 years ago

To have the title of its AgeGroupSet, use: SELECT ?ageGroupSetTitle WHERE { ?ageGroupSetUri hxl:title ?ageGroupSetTitle ; a hxl:AgeGroupSet . ?sequence ?sequenceMember http://hxl.humanitarianresponse.info/data/agegroups/unhcr/ages_0-4 . FILTER ( regex (str(?sequenceMember), "#_\d+$") ). }

cjhendrix commented 12 years ago

Vincent figured out the query for this:

PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX hxl: http://hxl.humanitarianresponse.info/ns/# SELECT ?ageGroupSetTitle WHERE { ?ageGroupSetUri hxl:title ?ageGroupSetTitle ; a hxl:AgeGroupSet, rdf:Seq . ?sequence ?sequenceMember http://hxl.humanitarianresponse.info/data/agegroups/unhcr/ages_0-4 . FILTER ( regex (str(?sequenceMember), "#_\d+$") ). }

cjhendrix commented 12 years ago

Actually, this works more simply: PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# PREFIX hxl: http://hxl.humanitarianresponse.info/ns/# SELECT DISTINCT ?ageGroupSetTitle WHERE { ?ageGroupSetUri hxl:title ?ageGroupSetTitle ; a hxl:AgeGroupSet ; ?foo http://hxl.humanitarianresponse.info/data/agegroups/unhcr/ages_0-4 . }

crstn commented 12 years ago

Fixed in https://github.com/hxl-team/HXLator/commit/56005fbbee25f60778b7693ac3058106aa27b53b

I have also changed the UNHCR age groups data. They now use a ref:List and the rdfs:member property.