330 likes | 467 Views
Graphically Querying RDF Using RDF-GL.
E N D
Graphically Querying RDF Using RDF-GL This talk is based on the paper RDF-GL: A SPARQL-Based Graphical Query Language for RDF. Hogenboom, F.P., Milea, D.V., Frasincar, F. & Kaymak, U. (2010). In Y. Badr, A. Abraham, A.-E. Hassanien & R. Chbeir (Eds.), Emergent Web Intelligence: Advanced Information Retrieval (Advanced Information and Knowledge Processing) (pp. 87-116). Springer London. Dutch-Belgian Database Day 2010 (DBDBD 2010)
Introduction Increasing amount of information Querying large databases quickly and efficiently is desired This need is addressed by several tools and languages However, intuitiveness is often of less importance (expressivity over clarity) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Graphical Query Languages Enable users to create queries by arranging and connecting symbols on a canvas Build on existing textual query languages Abstract away from difficult syntax and hence aim to enhance intuitiveness Coverage of textual equivalents vs. maintaining usability Available for semi-structured representations such as XML, but no SPARQL-based GQL for RDF RDF-GL is a GQL for a SPARQL subset Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL • Covers most SPARQL SELECT queries • No support for: • Prologue: BASE and PREFIX • Query type: ASK, CONSTRUCT, DESCRIBE • REDUCED, FROM, NAMED, GRAPH • However, the design of the language allows for extension • Based on SPARQL and not on SPARQL 1.1 Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Example (1) PREFIX j.1: <http://www.daml.org/2003/09/factbook/factbook-ont#> SELECT DISTINCT ?name ?oil WHERE { ?country j.1:localShortCountryName ?name . ?country j.1:grossDomesticProductPerCapita ?gdp . { FILTER (?gdp < 1500) . } UNION { FILTER (?gdp > 2500) . } OPTIONAL { ?country j.1:oilProvedReserves ?oil . } } ORDER BY ASC(?gdp) Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Example (2) Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Basic Elements { , } Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Mapping to SPARQL (1) PREFIX j.1: <http://www.daml.org/2003/09/factbook/factbook-ont#> SELECT DISTINCT ?elevation WHERE { ?country j.1:elevation ?elevation . } ORDER BY DESC(?elevation) OFFSET 5 LIMIT 4 Query type and sequence modifiers Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Mapping to SPARQL (2) FILTER (?gdp > 1250) . Filters j.1:EthnicGroup rdfs:subClassOf ?class . Triples Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Mapping to SPARQL (3) ?country j.1:highwaysTotal ?hw . { FILTER (?hw < 20000) . } UNION { FILTER (?hw > 150000) . } Unions Options OPTIONAL { ?country j.1:heliports ?heli . } Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Mapping to SPARQL (4) ?country j.1:highwaysTotal ?hw . { FILTER (?hw < 20000) . } UNION { FILTER (?hw > 150000) . OPTIONAL { ?country j.1:heliports ?heli . } } Nesting Dutch-Belgian Database Day 2010 (DBDBD 2010)
RDF-GL: Converting to SPARQL • Generate default PREFIXes (RDF, RDFS, XSD, etc.) • Determine query TYPE • Generate WHERE clause: • Convert all arrows and their connected boxes to triples • Add triples not connected to UNIONs or OPTIONALs to query • Add UNION and OPTIONAL circles and their children to query recursively • Determine ORDER BY • Determine LIMIT and OFFSET Dutch-Belgian Database Day 2010 (DBDBD 2010)
Implementation: SPARQLinG (1) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Implementation: SPARQLinG (2) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Experiments (1) • Query the CIA World Factbook for countries which have an import or export to neighbors worth more than $10 billion a year • The query needs to return: • The names of both the countries and their neighboring trading partners • The percentages of imports and exports • Optionally the inflation rate of the neighboring partners • Only the first 20 results are desired and should be ordered by country name (ascending) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Experiments (2) PREFIX j.1: <http://www.daml.org/2003/09/factbook/factbook-ont#> SELECT DISTINCT ?nameC ?nameN ?percentExp ?percentImp ?inflation WHERE { ?country j.1:conventionalShortCountryName ?nameC . ?country j.1:border ?border . ?border j.1:country ?neighbor . ?neighbor j.1:conventionalShortCountryName ?nameN . ?country j.1:exportPartner ?partnerExp . ?partnerExp j.1:percent ?percentExp . ?partnerExp j.1:country ?neighbor . ?country j.1:importPartner ?partnerImp . ?partnerImp j.1:percent ?percentImp . ?partnerImp j.1:country ?neighbor . { ?country j.1:imports ?imports . FILTER (?imports > 10000000000) . } UNION { ?country j.1:exports ?exports . FILTER (?exports > 10000000000) . } OPTIONAL { ?neighbor j.1:inflationRate ?inflation . } } ORDER BY ASC(?nameC) LIMIT 20 Dutch-Belgian Database Day 2010 (DBDBD 2010)
Experiments (3) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Experiments (4) • The creation of RDF-GL queries is not necessarily faster than the creation of SPARQL queries • However, the GQL and tool offer: • Overview • Easy reuse of variables • Maintenance Dutch-Belgian Database Day 2010 (DBDBD 2010)
Order Dependency in SPARQL SELECT ?name ?alias WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:nick ?alias . } OPTIONAL { ?x foaf:mbox ?alias . } } SELECT ?name ?alias WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?alias . } OPTIONAL { ?x foaf:nick ?alias . } } • OPTIONAL is not commutative, causing problems when sharing variables in OPTIONAL clause: • We need a binary OPTIONAL operator which is commutative and associative Dutch-Belgian Database Day 2010 (DBDBD 2010)
Discussion • AND-relationship is implicit, OR-relationship is explicit • Issues: • No coverage for the complete SPARQL language • Determining statement order is difficult • Solutions: • Extend language by using: • Extra symbols • Extra colors/shadings • Extra shapes • Add numbers for ordering, make use of the horizontal or vertical position of elements, etc. Dutch-Belgian Database Day 2010 (DBDBD 2010)
Conclusions • RDF-GL is a GQL for SPARQL • The GQL covers a subset of SPARQL (i.e., almost all SELECT queries) • Future work: • Implement a way to determine query order • Extend the language to include more of SPARQL, i.e., • Visualization: • Widget size indicating importance • Lay-out algorithm • SPARQL to RDF-GL conversion Dutch-Belgian Database Day 2010 (DBDBD 2010)
Questions Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (1) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (2) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (3) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (4) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (5) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF non-terminals (6) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF terminals (1) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF terminals (2) Dutch-Belgian Database Day 2010 (DBDBD 2010)
Appendix: EBNF terminals (3) Dutch-Belgian Database Day 2010 (DBDBD 2010)