buda-base / lds-queries

A repository for BUDA Linked Data Server
Apache License 2.0
0 stars 1 forks source link

add some report queries #8

Open eroux opened 6 years ago

eroux commented 6 years ago

Some report queries could be useful to have, I just made two (although they should be merged into one), here they are for the record:

prefix :        <http://purl.bdrc.io/ontology/core/>
prefix adm:     <http://purl.bdrc.io/ontology/admin/>
prefix bdr:     <http://purl.bdrc.io/resource/>
prefix skos:    <http://www.w3.org/2004/02/skos/core#>

select ?workId ?nodeId ?title ?bvol ?epage ?volPages {
  ?node adm:workLegacyNode ?nodeId ;
        skos:prefLabel ?title ;
        :workLocation ?loc .
  ?loc  :workLocationVolume ?bvol ;
        :workLocationWork ?workId ;
        :workLocationEndPage ?epage .
  optional { ?loc :workLocationEndVolume ?evol } .
  filter (!bound(?evol))
  ?workId adm:status bdr:StatusReleased .
  ?workId :workHasItemImageAsset/:itemHasVolume ?v .
  ?v :volumeNumber ?bvol .
  ?v :volumePagesTotal ?volPages .
  filter (?epage > ?volPages && ?volPages > 0)
}

and

prefix :        <http://purl.bdrc.io/ontology/core/>
prefix adm:     <http://purl.bdrc.io/ontology/admin/>
prefix bdr:     <http://purl.bdrc.io/resource/>
prefix skos:    <http://www.w3.org/2004/02/skos/core#>

select ?workId ?nodeId ?title ?bvol ?epage ?volPages {
  ?node adm:workLegacyNode ?nodeId ;
        skos:prefLabel ?title ;
        :workLocation ?loc .
  ?loc  :workLocationVolume ?bvol ;
        :workLocationWork ?workId ;
        :workLocationPage ?bpage ;
        :workLocationEndPage ?epage ;
        :workLocationEndVolume ?evol .
  ?workId :workHasItemImageAsset/:itemHasVolume ?v .
  ?v :volumeNumber ?evol .
  ?v :volumePagesTotal ?volPages .
  filter (?epage > ?volPages)
}

there's no action to take right now, it's mostly to record the queries in the meantime

also for missing volumes:

select ?workId ?volnum ?imagegroupid {
  ?v :volumePagesTotal 2 ;
     adm:legacyImageGroupRID ?imagegroupid ;
     :volumeNumber ?volnum .
  ?workId :workHasItemImageAsset/:itemHasVolume ?v ;
          adm:status bdr:StatusReleased .
}