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

Post on 03-Feb-2016

40 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Saving the world throughthe wonder that is

>>> CQL <<<Mike Taylor <mike@indexdata.com>

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

With a little help from BMNH R5937 “The Archbishop”

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Overview

Where we're headed:

Why OpenSearch rules so much

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Overview

Where we're headed:

Why OpenSearch rules so muchWhy OpenSearch sucks so hard

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Overview

Where we're headed:

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Overview

Where we're headed:

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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?

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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!

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

Why OpenSearch sucks so hard

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Ghasty proprietaryquery language #1

Revolting proprietaryquery language #2

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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

Saving the world through CQL Mike Taylor, Index Data <mike@indexdata.com>

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!

!!!!!!

Mike Taylor, Index Data <mike@indexdata.com>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL

Mike Taylor, Index Data <mike@indexdata.com>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQLLovely CQL

Mike Taylor, Index Data <mike@indexdata.com>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL Lovely CQLLovely CQL

Mike Taylor, Index Data <mike@indexdata.com>

CQL saves the world!

Saving the world through CQL

OpenSearchSRUMetasearcher

SRUServer 1

SRUServer 3

SRUServer 2

Lovely CQL Lovely CQLLovely CQL

: –)

Mike Taylor, Index Data <mike@indexdata.com>

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.###

Mike Taylor, Index Data <mike@indexdata.com>

What if ...

Saving the world through CQL

OpenSearchMetasearcher

OpenSearchServer 1

OpenSearchServer 3

OpenSearchServer 2

Lovely CQLEven morelovely CQL!Yum!

Lovely CQL

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

dinosaur

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebra

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaur

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

dinosaurdinosaur and vertebradinosaur or pterosaurvertebra not dorsal

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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)

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

OK, what actually is CQL?

Saving the world through CQL

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

Mike Taylor, Index Data <mike@indexdata.com>

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.)

Mike Taylor, Index Data <mike@indexdata.com>

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.

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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?

Mike Taylor, Index Data <mike@indexdata.com>

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());}

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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: $@";}

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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);}

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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.”

Mike Taylor, Index Data <mike@indexdata.com>

Boldly facing a bright new dawn

Saving the world through CQL

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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

Mike Taylor, Index Data <mike@indexdata.com>

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!

Mike Taylor, Index Data <mike@indexdata.com>

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!

Saving the world throughthe wonder that is

>>> CQL <<<Mike Taylor <mike@indexdata.com>

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.

top related