saving the world through the wonder that is >>> cql

55
aving the world thr the wonder that i >>> CQL <<< Mike Taylor <[email protected] > Index Data – http://www.indexdata.co With a little help from BMNH R5937 “The Archbishop”

Upload: tino

Post on 03-Feb-2016

39 views

Category:

Documents


0 download

DESCRIPTION

Saving the world through the wonder that is >>> CQL

TRANSCRIPT

Page 1: Saving the world through the wonder that is >>>  CQL

Saving the world throughthe wonder that is

>>> CQL <<<Mike Taylor <[email protected]>

Index Data – http://www.indexdata.com

With a little help from BMNH R5937 “The Archbishop”

Page 2: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so much

Page 3: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hard

Page 4: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hardCQL saves the world!

Page 5: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hardCQL saves the world!Why CQL is hard to implement

Page 6: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hardCQL saves the world!Why CQL is hard to implementWhy CQL is easy to implement

Page 7: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hardCQL saves the world!Why CQL is hard to implementWhy CQL is easy to implementNow what?

Page 8: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch rules so much

OpenSearch is great because:It gives clients a well-defined way to request searchesIt returns data in a well-known format

OpenSearchMetasearcher

OpenSearchServer 1

Nice, coherent XML

Page 9: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch rules so much

OpenSearch is great because:It gives clients a well-defined way to request searchesIt returns data in a well-known format

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 2

Nice, coherent XML Same XML

Page 10: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch rules so much

OpenSearch is great because:It gives clients a well-defined way to request searchesIt returns data in a well-known format

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Nice, coherent XML Same XML Same XML again!

Page 11: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Page 12: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Revolting proprietaryquery language #2

Page 13: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Revolting proprietaryquery language #2

Ethically horrifying,foul and totallyincomprehensiblequery language #3

Page 14: Saving the world through the wonder that is >>>  CQL

Saving the world through CQL Mike Taylor, Index Data <[email protected]>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Revolting proprietaryquery language #2

Ethically horrifying,foul and totallyincomprehensiblequery language #3

!!!!!!

Aaaargh!Aaaargh!

!!!!!!

Page 15: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL

Page 16: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQLLovely CQL

Page 17: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL Lovely CQLLovely CQL

Page 18: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL Lovely CQLLovely CQL

: –)

Page 19: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

CQL saves the world: see for yourself

Saving the world through CQL

EuropeanLibrary

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL Lovely CQLLovely CQL

Talk to Theo about thishttp://www.###

Page 20: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

What if ...

Saving the world through CQL

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Lovely CQLEven morelovely CQL!Yum!

Lovely CQL

Page 21: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaur

Page 22: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebra

Page 23: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaur

Page 24: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal

Page 25: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal(dinosaur or pterosaur) and (vertebra not dorsal)

Page 26: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal(dinosaur or pterosaur) and (vertebra not dorsal)title=churchill

Page 27: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal(dinosaur or pterosaur) and (vertebra not dorsal)title=churchillcreator=churchill

Page 28: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal(dinosaur or pterosaur) and (vertebra not dorsal)title=churchillcreator=churchillsubject = (dinosaurs and biomechanics)

Page 29: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal(dinosaur or pterosaur) and (vertebra not dorsal)title=churchillcreator=churchillsubject = (dinosaurs and biomechanics)

Hey! What's the big deal? This is easy!

Page 30: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

People of a faint disposition might like to look away now.

Page 31: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

People of a faint disposition might like to look away now.

dc.author=(kern* or ritchie) and (bath.title exact "the c programming language" or dc.title=elements prox/distance=4 dc.title=programming) and subject any/relevant "style design analysis"

(Yes, that's all one query.)

Page 32: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

OK, what actually is CQL?

Saving the world through CQL

People of a faint disposition might like to look away now.

dc.author=(kern* or ritchie) and (bath.title exact "the c programming language" or dc.title=elements prox/distance=4 dc.title=programming) and subject any/relevant "style design analysis"

(Yes, that's all one query.)

Don't try this at home, kids. Get JavaScript to build it for you.

Page 33: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

The CQL learning curve

Saving the world through CQL

Power of query that can be expressed

Eff

ort

in learn

ing q

uery

lan

guag

e

SQL

Page 34: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

The CQL learning curve

Saving the world through CQL

Power of query that can be expressed

Eff

ort

in learn

ing q

uery

lan

guag

e

SQL

Google

Page 35: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

The CQL learning curve

Saving the world through CQL

Power of query that can be expressed

Eff

ort

in learn

ing q

uery

lan

guag

e

SQL

Google

CQL

Page 36: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is hard to implement

Saving the world through CQL

Are you kidding? Just look at all that power:

multi-word terms with wildcards and anchoringindexes (creator, title, subject ...)index prefixes (dc for Dublin Core, rec for Record Metadata)relations (< <= => > = <> exact all any)relation modifiersbooleans (and, or, not, prox)boolean modifiers (ouch, ouch, ouch)prefix mapping ... and much, much more!

Page 37: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement

Saving the world through CQL

How do you decode CGI parameters?– use a library!

How do you parse XML?– use a library!

How do you send an HTTP request and get the response?– use a library!

Page 38: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement

Saving the world through CQL

How do you decode CGI parameters?– use a library!

How do you parse XML?– use a library!

How do you send an HTTP request and get the response?– use a library!

Now, who can guess how to parse CQL?

Page 39: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Java)

Saving the world through CQL

import org.z3950.zing.cql;

CQLParser parser = new CQLParser();CQLNode root;try {

root = parser.parse(cql);} catch (CQLParseException ex) {

System.err.println("Syntax error: " + ex.getMessage());}

Page 40: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Java)

Saving the world through CQL

import org.z3950.zing.cql;

CQLParser parser = new CQLParser();CQLNode root;try {

root = parser.parse(cql);} catch (CQLParseException ex) {

System.err.println("Syntax error: " + ex.getMessage());}

Super-easy!Super-easy!

Page 41: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Perl)

Saving the world through CQL

use CQL::Parser;

my $parser = new CQL::Parser();my $node;eval {

$node = $parser->parse($query);}; if ($@) {

die "CQL syntax error: $@";}

Page 42: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Perl)

Saving the world through CQL

use CQL::Parser;

my $parser = new CQL::Parser();my $node;eval {

$node = $parser->parse($query);}; if ($@) {

die "CQL syntax error: $@";}

EmbarrassinglyEmbarrassingly

Trivial!Trivial!

Page 43: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (C)

Saving the world through CQL

#include <yaz/cql.h>

CQL_parser cp = cql_parser_create();struct cql_node *root;r = cql_parser_string(cp, query);if (r) {

fprintf(stderr, "Syntax error\n");} else {

root = cql_parser_result(cp);}

Page 44: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (C)

Saving the world through CQL

#include <yaz/cql.h>

CQL_parser cp = cql_parser_create();struct cql_node *root;r = cql_parser_string(cp, query);if (r) {

fprintf(stderr, "Syntax error\n");} else {

root = cql_parser_result(cp);}

A child of threeA child of three

could do it!could do it!

Page 45: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Intercal)

Saving the world through CQL

DO (5) NEXT (5) DO FORGET #1 PLEASE WRITE IN :1 DO .1 <- 'V-":1~'#32768c/#0'"c/#1'~#3 DO (1) NEXT DO :1 <- "'V-":1~'#65535c/#0'"c/#65535' ~'#0c/#65535'"c/"'V-":1~'#0c/#65535'" c/#65535'~'#0c/#65535'" DO :2 <- #1 PLEASE DO (4) NEXT (4) DO FORGET #1 DO .1 <- "V-':1~:2'c/#1"~#3 DO :1 <- "'V-":1~'#65535c/#0'"c/":2~'#65535 c/#0'"'~'#0c/#65535'"c/"'V-":1~'#0

Page 46: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Why CQL is easy to implement (Intercal)

Saving the world through CQL

DO (5) NEXT (5) DO FORGET #1 PLEASE WRITE IN :1 DO .1 <- 'V-":1~'#32768c/#0'"c/#1'~#3 DO (1) NEXT DO :1 <- "'V-":1~'#65535c/#0'"c/#65535' ~'#0c/#65535'"c/"'V-":1~'#0c/#65535'" c/#65535'~'#0c/#65535'" DO :2 <- #1 PLEASE DO (4) NEXT (4) DO FORGET #1 DO .1 <- "V-':1~:2'c/#1"~#3 DO :1 <- "'V-":1~'#65535c/#0'"c/":2~'#65535 c/#0'"'~'#0c/#65535'"c/"'V-":1~'#0

So easy,So easy,

it hurts!it hurts!

Page 47: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Now what?

Saving the world through CQL

Once you've got your CQL parse tree ...

Walk the treeConvert it to your database's local query languageIf a CQL construct is unsupported, throw a diagnostic

Page 48: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Now what?

Saving the world through CQL

Once you've got your CQL parse tree ...

Walk the treeConv ert it to your database's local query languageIf a CQL construct is unsupported, throw a diagnostic

It doesn't matter if you don't implement the whole language(No-one does that.) The goal is:

“if you can say it in your DB, you can say it in CQL.”

Page 49: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Page 50: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Winners:Content providers: their databases get used

Page 51: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Winners:Content providers: their databases get usedVendors: they can concentrate on the interesting problems

Page 52: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Winners:Content providers: their databases get usedVendors: they can concentrate on the interesting problemsLibraries: they don't need expensive metasearch solutions

Page 53: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Winners:Content providers: their databases get usedVendors: they can concentrate on the interesting problemsLibraries: they don't need expensive metasearch solutionsUsers: they find more good stuff!

Page 54: Saving the world through the wonder that is >>>  CQL

Mike Taylor, Index Data <[email protected]>

Boldly facing a bright new dawn

Saving the world through CQL

It really and truly is not that big a deal to implement CQL.

Winners:Content providers: their databases get usedVendors: they can concentrate on the interesting problemsLibraries: they don't need expensive metasearch solutionsUsers: they find more good stuff!

Losers:No-one!

Page 55: Saving the world through the wonder that is >>>  CQL

Saving the world throughthe wonder that is

>>> CQL <<<Mike Taylor <[email protected]>

Index Data – http://www.indexdata.com

With a little help from BMNH R5937 “The Archbishop”, an as-yet undescribed brachiosaurid sauropod from the Upper Jurassic of the Tendaguru formation, Tanzania, Africa.