Changes between Version 6 and Version 7 of CMD2RDF/Queries


Ignore:
Timestamp:
05/23/14 21:27:54 (10 years ago)
Author:
xnrn@gmx.net
Comment:

added further queries with data categories

Legend:

Unmodified
Added
Removed
Modified
  • CMD2RDF/Queries

    v6 v7  
    5050}}}
    5151
     52List all used datcats, with english labels and counts:
     53{{{
     54#!sql
     55PREFIX dcr: <http://www.isocat.org/ns/dcr.rdf#>
     56
     57SELECT SAMPLE(?datcatid) SAMPLE(?datcatlabel) COUNT(?e) as ?count
     58WHERE {?e dcr:datcat ?datcatid.
     59       ?datcat dcr:datcat ?datcatid.
     60       ?datcat rdfs:label ?datcatlabel.
     61  FILTER(langMatches(lang(?datcatlabel), "EN"))
     62}
     63GROUP BY ?datcatid ?datcatlabel
     64ORDER BY DESC(?count)
     65}}}
     66[[http://clarin.aac.ac.at/virtuoso/sparql?default-graph-uri=&query=PREFIX+dcr%3A+%3Chttp%3A%2F%2Fwww.isocat.org%2Fns%2Fdcr.rdf%23%3E%0D%0A%0D%0ASELECT+SAMPLE%28%3Fdatcatid%29+SAMPLE%28%3Fdatcatlabel%29+COUNT%28%3Fe%29+as+%3Fcount%0D%0AWHERE+{%3Fe+dcr%3Adatcat+%3Fdatcatid.%0D%0A+++++++%3Fdatcat+dcr%3Adatcat+%3Fdatcatid.%0D%0A+++++++%3Fdatcat+rdfs%3Alabel+%3Fdatcatlabel.%0D%0A++FILTER%28langMatches%28lang%28%3Fdatcatlabel%29%2C+%22EN%22%29%29%0D%0A}%0D%0AGROUP+BY+%3Fdatcatid+%3Fdatcatlabel%0D%0AORDER+BY+DESC%28%3Fcount%29&format=text%2Fhtml&timeout=0&debug=on|datcat with label and counts]]
     67
    5268List all relations from the relation registry:
    5369{{{
     
    5571SELECT ?dc1 ?reltype ?dc2
    5672WHERE {
    57        { GRAPH <http://clarin.eu/cmd/rr-cmdi.rdf> {?dc1 ?reltype ?dc2 } }
    58  UNION { GRAPH <http://clarin.eu/cmd/rr-dc.rdf> {?dc1 ?reltype ?dc2 } }
     73       { GRAPH <http://www.clarin.eu/cmd/rr-cmdi.rdf> {?dc1 ?reltype ?dc2 } }
     74 UNION { GRAPH <http://www.clarin.eu/cmd/rr-dc.rdf> {?dc1 ?reltype ?dc2 } }
    5975}
     76}}}
     77
     78List values in fields for given data category (`DC-2544` resourceTitle):
     79{{{
     80#!sql
     81PREFIX dcr: <http://www.isocat.org/ns/dcr.rdf#>
     82
     83SELECT ?v as ?resourcetitle
     84WHERE {?cmdelem dcr:datcat "http://www.isocat.org/datcat/DC-2544".
     85       ?instelem a ?cmdelem.
     86       ?instelem ?p ?v.
     87FILTER isLiteral(?v)
     88}
     89ORDER BY ?v
     90}}}
     91
     92Datcats with the number of elements they are references by and the number of corresponding instances:
     93{{{
     94#!sql
     95PREFIX dcr: <http://www.isocat.org/ns/dcr.rdf#>
     96
     97SELECT SAMPLE(?datcatid) COUNT(distinct ?cmdelem) as ?count COUNT(?instelem) as ?count_instances
     98WHERE {?cmdelem  dcr:datcat ?datcatid.     
     99       ?instelem a ?cmdelem.
     100}
     101GROUP BY ?datcatid
     102ORDER BY DESC(?count_instances)
    60103}}}
    61104
     
    100143
    101144
     145=== Search by DatCat
     146
     147Search in description fields for string `syntax` or `parse`:
     148{{{
     149#!sql
     150PREFIX dcr: <http://www.isocat.org/ns/dcr.rdf#>
     151
     152SELECT ?v as ?resourcetitle
     153WHERE {?cmdelem dcr:datcat "http://www.isocat.org/datcat/DC-2520".
     154       ?instelem a ?cmdelem.
     155       ?instelem ?p ?v.
     156FILTER isLiteral(?v).
     157FILTER REGEX(?v, "(syntax|parse)", "i")
     158}
     159}}}
     160
     161[[http://clarin.aac.ac.at/sparql?default-graph-uri=&query=PREFIX+dcr%3A+%3Chttp%3A%2F%2Fwww.isocat.org%2Fns%2Fdcr.rdf%23%3E%0D%0A%0D%0ASELECT+%3Fv+as+%3Fresourcetitle%0D%0AWHERE+{%3Fcmdelem+dcr%3Adatcat+%22http%3A%2F%2Fwww.isocat.org%2Fdatcat%2FDC-2520%22.%0D%0A+++++++%3Finstelem+a+%3Fcmdelem.%0D%0A+++++++%3Finstelem+%3Fp+%3Fv.%0D%0AFILTER+isLiteral%28%3Fv%29.%0D%0AFILTER+REGEX%28%3Fv%2C+%22%28syntax%7Cparse%29%22%2C+%22i%22%29%0D%0A}&format=text%2Fhtml&timeout=10000&debug=on| syntax or parse in description ]] (by datcat: [[http://isocat.org/datcat/2520|Description]] `DC-2520`)
     162