def cpbGetSchemaDetail(formatSpec):
    """
        Define SPARQL query to get information about a digitial object
        to assmble the underlying binary data structure schema for
        access to the binary file.
        :param formatSpec url for the specification  
    """

    query = """
            prefix cpmeta: <http://meta.icos-cp.eu/ontologies/cpmeta/>
            SELECT distinct ?objFormat ?colName ?valueType ?valFormat ?unit ?qKind ?colTip ?isRegex
            WHERE {
                <%(formSpec)s> cpmeta:containsDataset ?dset .
                <%(formSpec)s> cpmeta:hasFormat ?objFormat .
                ?dset cpmeta:hasColumn ?column .
                ?column cpmeta:hasColumnTitle ?colName ;
                    cpmeta:hasValueFormat ?valFormat ;
                    cpmeta:hasValueType ?valType .                
                ?valType rdfs:label ?valueType .
                optional{?valType rdfs:comment ?colTip }
                optional{ ?column cpmeta:isRegexColumn ?isRegex } .
                optional{
                    ?valType cpmeta:hasUnit ?unit .
                    ?valType cpmeta:hasQuantityKind [rdfs:label ?qKind ] .
                }
            } order by ?colName                       
            """ % {'formSpec': formatSpec}
    return query