- From: Juergen Umbrich <jueumb@gmail.com>
- Date: Thu, 22 Jan 2015 16:53:27 +0100
- To: SemanticWeb Mailinglist <semantic-web@w3.org>, public-lod public <public-lod@w3.org>
Some other pointers and queries from https://github.com/fadmaa/rdf-analytics/blob/master/queries.txt ========== query 7 (graph summary query)========== /* this computes the "schema" of an RDF dataset. This is based on the queries generated by Sindice Sparqled: https://github.com/sindice/sparqled/tree/master/sparql-summary/src/main/java/org/sindice/summary See also http://sheeeer.wordpress.com/2011/05/05/a-shot-at-rdf-schema-discovery/ for related topic and a way to visualise the results /* SELECT ?label (COUNT (?label) AS ?cardinality) ?source ?target WHERE { { SELECT ?s (GROUP_CONCAT(concat('<',str(?type),'>')) AS ?source) WHERE { { SELECT ?s ?type WHERE { { ?s a ?type . } } ORDER BY ?type } } GROUP BY ?s } ?s ?label ?sSon . OPTIONAL { { SELECT ?sSon (GROUP_CONCAT(concat('<',str(?typeSon),'>')) AS ?target) WHERE { { SELECT ?sSon ?typeSon WHERE { { ?sSon a ?typeSon . } } ORDER BY ?typeSon } } GROUP BY ?sSon } } } GROUP BY ?label ?source ?target there is also the work of the Sindice group around graph-summary: code here: https://github.com/sindice/sparqled/tree/master/sparql-summary > On 22 Jan 2015, at 16:25, Bernard Vatant <bernard.vatant@mondeca.com> wrote: > > Interesting to note that the answers so far are converging towards looking first for types and predicates, but bottom-up from the data, and not queries looking for a declared model layer using RDFS or OWL, such as e.g., > > SELECT DISTINCT ?class > WHERE { {?class a owl:Class} UNION {?class a rdfs:Class}} > > SELECT DISTINCT ?property ?domain ?range > WHERE { {?property rdfs:domain ?domain} UNION {?property rdfs:range ?range}} > > Which means globally you don't think the SPARQL endpoint will expose a formal model along with the data. > That said, if the model is exposed with the data, the values of rdf:type will contain e.g., rdfs:Class and owl:Class ... > > Of course in the ideal situation where you have an ontology, the following would bring its elements. > > SELECT DISTINCT ?o ?x ?type > WHERE {?x rdf:type ?type. > ?x rdfs:isDefinedBy ?o. > ?o a owl:Ontology } > > It's worth trying, because if the dataset you query is really big, it will be faster to look first for a declared model than asking all distinct rdf:type > > > 2015-01-22 15:23 GMT+01:00 Alfredo Serafini <seralf@gmail.com>: > Hi > > the most basic query is the usual query for concepts, something like: > > SELECT DISTINCT ?concept > WHERE { > ?uri a ?concept. > } > > then, given a specific concept, you can infer from the data what are the predicates/properties for it: > SELECT DISTINCT ?prp > WHERE { > [] ?prp <a-concept>. > } > > and so on... > > Apart from other more complex query (here we are of course omitting a lot of important things), these two "patterns" are usually the most useful as a starting point, for me. > > > > > 2015-01-22 15:09 GMT+01:00 Juan Sequeda <juanfederico@gmail.com>: > Assume you are given a URL for a SPARQL endpoint. You have no idea what data is being exposed. > > What do you do to explore that endpoint? What queries do you write? > > Juan Sequeda > +1-575-SEQ-UEDA > www.juansequeda.com > > > > > -- > Bernard Vatant > Vocabularies & Data Engineering > Tel : + 33 (0)9 71 48 84 59 > Skype : bernard.vatant > http://google.com/+BernardVatant > -------------------------------------------------------- > Mondeca > 35 boulevard de Strasbourg 75010 Paris > www.mondeca.com > Follow us on Twitter : @mondecanews > ----------------------------------------------------------
Received on Thursday, 22 January 2015 15:53:53 UTC