Schnittstellen und Webservices

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Schnittstellen und Webservices - Presentation Transcript

    1. Digitale Bibliothek Jakob Voß Schnittstellen und Webservices Digitale Bibliothek WS 2008/2009 Fachhochschule Hannover Informationsmanagement (BA) 13. Oktober 2008
    2. Zusammenfassung Datenformate
      • Es gibt viele Wege, die gleichen Informationen zu kodieren
      • Festlegung von Datenformaten geschieht durch aufeinander aufbauende Standards
        • Abstrakte Strukturierung ( Datenmodell )
        • Konkrete Kodierung ( Datenformat )
        • Anwendung ( Werkzeuge und Praxis )
      • Einhaltung von Standards muss mittels Validierung überprüft werden
    3. Zeitangabe nach RFC 822*
      • date-time = [ day "," ] date time ; dd mm yy
      • ; hh:mm:ss zzz
      • day = "Mon" / "Tue" / "Wed" / "Thu"
      • / "Fri" / "Sat" / "Sun"
      • date = 1*2DIGIT month 2DIGIT ; day month year
      • ; e.g. 20 Jun 82
      • month = "Jan" / "Feb" / "Mar" / "Apr"
      • / "May" / "Jun" / "Jul" / "Aug"
      • / "Sep" / "Oct" / "Nov" / "Dec"
      • time = hour zone ; ANSI and Military
      • hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT]
      • ; 00:00:00 - 23:59:59
      • zone = "UT" / "GMT" ; Universal Time
      • ; North American : UT
      • / "EST" / "EDT" ; Eastern: - 5/ - 4
      • / "CST" / "CDT" ; Central: - 6/ - 5
      • / "MST" / "MDT" ; Mountain: - 7/ - 6
      • / "PST" / "PDT" ; Pacific: - 8/ - 7
      • / 1ALPHA ; Military: Z = UT;
      • ; A:-1; (J not used)
      • ; M:-12; N:+1; Y:+12
      • / ( ("+" / "-") 4DIGIT ) ; Local differential
      • ; hours+min. (HHMM)
      Formale Regeln in Backus- Naur-Form *STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES (E-Mail) August 13, 1982
    4. Motivation
      • Für Aufbau, Weiterentwicklung und Wartung digitaler Bibliotheken sind Kenntnisse von Datenformaten und Schnittstellen (Zweck, Eigenschaften...) unerlässlich.
    5. Wie kommen nun die Daten zusammen? Dokumente Nutzer Datenbank Experte Autor Beitrag Dokumente Datensatz Datenbank Datensatz Anwendung Datenbank Unbekanntes System Anwendung
    6. Wie kommen nun die Daten zusammen? Dokumente Nutzer Datenbank Experte Anwendung Autor Beitrag Dokumente Datensatz Datenbank Datensatz Anwendung Datenbank Unbekanntes System
    7. Schnittstellen Benutzer Benutzerschnittstelle Programmierschnittstelle Informations- system Programm
    8. Programmierschnittstellen = Application Programming Interface (API)
      • Spezifikation durch Standards
      • Implementation durch Programme
      • Kompatibilität durch gemeinsame Einhaltung der Spezifikation
      • Nutzung von Diensten (Services) durch andere Programme
      • Grundprinzip: Daten rein, Daten raus
    9. Beispiel: HTTP
        • Cache-Control: private
        • Content-Type: text/html; charset=UTF-8
        • Content-Encoding: gzip
        • Server: gws
        • Content-Length: 1845
        • Date: Mon, 01 Oct 2007 09:05:53 GMT
        • 200 OK
        • ...
        • GET /search?q=internet HTTP/1.1
        • Host: www.google.de
        • User-Agent: Mozilla/5.0 (...)
        • ...
        • Referer: http://www.wikipedia.de/wiki/Internet
      Relevant auch für Webserver-Logfiles
        • Antwort
        • Anfrage
    10. Beispiel: HTTP
        • Cache-Control: private
        • Content-Type: text/html; charset=UTF-8
        • Content-Encoding: gzip
        • Server: gws
        • Content-Length: 1845
        • Date: Mon, 01 Oct 2007 09:05:53 GMT
        • 200 OK
        • ...
        • GET /search?q=internet HTTP/1.1
        • Host: www.google.de
        • User-Agent: Mozilla/5.0 (...)
        • ...
        • Referer: http://www.wikipedia.de/wiki/Internet
        • Antwort
        • Anfrage
      URL DNS MIME type HTML RFC 822 date-time
    11. Relevante Schnittstellen für Digitale Bibliotheken
      • Suchen: Z39.50, SRU/SRW, OpenSearch
      • Sammeln/Verteilen: OAI-PMH, ATOM, RSS
      • Kopieren/Status: unAPI, SeeAlso, DAIA
      • Bearbeiten: SRU Update, ATOMPub
      • Identity Management: Shibboleth, OpenID
      • Außerdem bisher: NCIP, SIP2 ...
      • Initiativen für bessere Schnittstellen:
        • Jangle, OCLC Service Grid ...
    12. Beispiel: unAPI
      • Zweck
        • Bereitstellung einzeln identifizierter Objekte
      • Anfragesyntax
        • HTTP-Request mit zwei Parametern
          • id: Identifikator des Objektes
          • format : Gewünschtes Format
      • Antwortsyntax
        • Formatliste in XML oder Objekt in einem gewünschten Format
    13. unAPI
      • BASEURL (keine Parameter)
      • Liste von allgemeinen Formaten
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
      • <formats>
      • <format name=&quot;text&quot; type=&quot;text/plain&quot; />
      • <format name=&quot;marcxml&quot; type=&quot;application/xml&quot; docs=&quot;http://www.loc.gov/standards/marcxml/&quot;/>
      • </formats>
    14. unAPI
      • BASEURL ?id= IDENTIFIER (kein Format)
      • Liste von Formaten für dieses Objekt
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
      • <formats id=&quot; IDENTIFIER &quot;>
      • <format name=&quot;text&quot; type=&quot;text/plain&quot; />
      • <format name=&quot;marcxml&quot; type=&quot;application/xml&quot; docs=&quot;http://www.loc.gov/standards/marcxml/&quot;/>
      • </formats>
    15. unAPI
      • BASEURL ?id= IDENTIFIER &format= FORMAT
      • Formatspezifisch (z.B. DC, MARCXML, ...)
      Datensatz unAPI Server
    16. Schnittstelle != Datenformat
      • Viele Schnittstellen lassen offen, welche konkreten Datenformate verwendet werden
      • Ähnlich wie bei allgemeinen Kodierungs-formen (XML, JSON, CSV...) und konkreten Kodierungen von Datenformaten
      • „Format X über Schnittstelle Y“
      • Beispiele:
        • HTML, XML ... über HTTP
        • DC, MARCXML ... über unAPI oder OAI-PMH
    17. API-Programmbibliotheken
      • Zugriff auf APIs mittels Programmiersprache
      • Beispiele: Z39.50-Client in PHP:
      • $con = yaz_connect ( &quot;z3950.loc.gov:7090/voyager&quot; );
      • yaz_syntax ( $con, &quot;usmarc&quot; );
      • yaz_range ( $con, 1, 10 );
      • yaz_search ( $con, &quot;rpn&quot;, $query );
      • yaz_wait ();
      • $hits = yaz_hits ( $con );
      • for ($p = 1; $p <= 10; $p++) {
      • $rec = yaz_record ( $con, $p, &quot;string&quot; );
      • # ...
      • }
    18. zustandslose und zustandsbasiere APIs
      • Alle Anfragen unabhängig voneinander
      • Keine Reihenfolge
      • Eine Anfrage reicht
      • z.B. HTTP, unAPI ...
      • „REST“
      • Anfragen bauen aufeinander auf
      • Stehende Verbindung
      • Beispiel: Login, Suche, Download
      • z.B. Z39.50, OAI resumptionToken ...
    19. Beispiel: OAI-PMH
      • Open Archives Initiative (OAI)
      • Protocol for Metadata Harvesting (PMH)
      • REST-API (außer: resumptionToken)
        • Anfrage: HTTP GET (URL)
        • Antwort: XML
      • Nützliche Anfrage: Neue Metadatensätze
      Metadatensatz OAI Data Provider Metadatensätze
    20. OAI-PMH
      • Repository als Data Provider
      • Harvester sammelt Metadaten-Records
      • Bereitstellung von Dienstleistungen durch Service-Provider
        • Beispiel: OAIster (http://www.oaister.org/)
    21. OAI-PMH
      • Anfrage-Parameter
        • verb (Identify, ListMetadataFormats, GetRecord, ListIdentifier, ListRecords)
        • identifier
        • metadataPrefix (oai_dc, ...)
        • from, until , set (Eingrenzung Datum/Menge)
        • resumptionToken (Ergebnisliste fortsetzen)
      • Ausprobieren: OAI Repository Explorer http://re.cs.uct.ac.za/
    22. Beispiel: Search/Retrieve via URL (SRU) Search/Retrieve Web Service (SRW)
      • Neuentwicklung der wichtigsten Z39.50-Funktionalität als Webservice
      • Suchabfrage von Datenbanken
      • verschiedene Operationen ( operation )
        • explain
        • searchRetrieve
        • scan
    23. SRU/SRW-searchRetrieve
      • Request aus mehreren optionalen Parametern
      • version ist notwendig, query enthält die Anfrage in Common Query Language (CQL)
      • Beispiel: http://gso.gbv.de/sru/DB=2.1/
    24. Beispiel: SeeAlso
      • Basiert auf unAPI und OpenSearch Suggestions
      • Query-Format:
        • wie unAPI mit format=seealso&id=...
      • Response-Format:
        • OpenSearch Suggestions (JSON)
        • [&quot;..id..&quot;,[..titles..],[..descriptions..],[..urls..]]
    25. (OpenSearch Suggestions) SeeAlso Linkserver ISBN JSON Links JavaScript
    26. (OpenSearch Suggestions) SeeAlso Wrapper Webservice ISBN JSON Verfügbarkeit JavaScript OPAC ISBN
    27. Spezifikation durch Standards
      • Ohne etablierte Programmbibliothek: Standard genau lesen!
      • Vertrauen ist gut, Kontrolle ist besser.
        • Z39.50: > 100 Seiten nicht frei verfügbar
        • OAI-PMH: ~ 30 Seiten http://www.openarchives.org/OAI/openarchivesprotocol.html
        • unAPI: 1 (+3) Seiten http://unapi.info/specs/
    28. Webservices
      • Informatiker-Buzzword
      • Komplex: SOAP, XML-RPC, WSDL...
      • Einfach: API über HTTP
      • Meist ist XML im Spiel
      • Kombination mehrere Services als „Mashup“
    29. Was tun ohne API?
      • Selber machen! (Scraping, Wraping...)
      • Vorteil
        • Lehrreich
      • Nachteil
        • Keine Verlässlichkeit
        • Meist aufwändiger (aber nicht immer)
        • Jemand könnte sich beschweren
      • Oft die einzige Möglichkeit
      • Tip: Firefox DownloadHelper -Plugin
    30. Verfügbarkeit ermitteln mittels Screen Scraper
      • Katalog der Bibliothek im Kurt-Schwitters-Forum
      • http://opc4.tib.uni-hannover.de:8080/DB=11/
      • Titeldaten Standort und Ausleihstatus
      • Raussuchen per Hand
    31. Verfügbarkeit ermitteln mittels Screen Scraper
      • use LWP::Simple;
      • my $opac = 'http://opc4.tib.uni-hannover.de:8080/DB=11';
      • my $ikt = 1016;
      • my $regexp = '>Ausleihstatus: </strong></td><td[^>]+>([^>]+)<BR>([^>]+)<';
      • my $isbn = shift @ARGV;
      • my @status;
      • if ($isbn) {
      • my $url = $opac . &quot;/CMD?ACT=SRCHA&IKT=&quot; . $ikt . &quot;&TRM=&quot; . $isbn;
      • my $html = get($url);
      • while ($html =~ m/$regexp/g) {
      • push @status, &quot;$isbn: $1, $2&quot;;
      • }
      • @status = (&quot;$isbn: nicht gefunden&quot;) unless @status;
      • print join(&quot; &quot;, @status) . &quot; &quot;;
      • } else {
      • print &quot;Usage: $0 ISBN &quot;;
      • }
    32. Verfügbarkeit ermitteln mittels Screen Scraper
      • $ ./isbn-at-schwitters.pl 3-931659-29-1
      • 3-931659-29-1: Ausleihbar, Bitte selbst am Standort Freihand dem Regal entnehmen
      • $ ./isbn-at-schwitters.pl 3-936931-16-X
      • 3-936931-16-X: Praesenzexemplar, -
      • 3-936931-16-X: Ausleihbar, z. Zt. ausgeliehen
      • 3-936931-16-X: Ausleihbar, z. Zt. ausgeliehen
      • $ ./isbn-at-schwitters.pl 978-0-8050-8043-8
      • 978-0-8050-8043-8: beim Buchhandel bestellt, -
      • $ ./isbn-at-schwitters.pl 978-3-446-41208-8
      • 978-3-446-41208-8: Praesenzexemplar, -
      • $ ./isbn-at-schwitters.pl 978-3-937514-42-0
      • 978-3-937514-42-0: nicht gefunden
    33. Vorhandensein über- prüfen mittels SRU-API
      • Gesamtkatalog Hannover
        • http://gso.gbv.de/DB=2.92/
      • SRU-Schnittstelle
        • http://gso.gbv.de/sru/DB=2.92/
      • Titel- und Exemplardaten im PICA-Format
    34. Vorhandensein über- prüfen mittels SRU-API
      • use PICA::Server;
      • my $isbn = shift @ARGV;
      • my @status;
      • if ($isbn) {
      • my $server = PICA::Server->new(
      • SRU => &quot;http://gso.gbv.de/sru/DB=2.92/&quot;
      • );
      • $server->cqlQuery( 'pica.isb=' . $isbn,
      • Record => sub {
      • $record = shift;
      • my @bib = $record->values('101@$d');
      • push @status, @bib;
      • }
      • );
      • @status = (&quot;$isbn: nicht gefunden&quot;) unless @status;
      • print join(&quot; &quot;, @status) . &quot; &quot;;
      • } else { print &quot;Usage: $0 ISBN &quot;; }
      API-Programmbibliothek
    35. Serviceorientierte Architektur (SOA)
      • Eine monolithische Anwendung
      • Geht nicht, unsere Software kann nicht
      • Viele lose gekoppelte Bausteine
      • Probier' es selber aus, hier sind die APIs!
    36. Integriertes Bibliothekssystem Suchindex Suchinterface Trefferanzeige Titelanzeige Katalogisierung Ausleihe Benachrichtigung Erwerbung Fernleihe u.v.a.m. Gespeicherte Suchen
    37. Modulares Bibliothekssystem Suchinterface Trefferanzeige Titelanzeige Katalogisierung Suchindex Ausleihe Fernleihe Gespeicherte Suchen Erwerbung Benachrichtigung
    38. Serviceorientiertes Bibliothekssystem Benachrichtigung Gespeicherte Suchen Katalogisierung Suchinterface Trefferanzeige Suchindex Erwerbung Ausleihe Fernleihe Titelanzeige Externe Anwendung Externe Anwendung Externe Anwendung
    39. Zusammenfassung
      • Schnittstellen (APIs) zum Datenaustausch
      • Webservices: APIs über HTTP (meist REST)
      • (Idealerweise) genau spezifiziert und mit Referenz-Programmbibliothek implementiert
      • Zustandslose Protokolle einfacher
      • Relevant für digitale Bibliotheken
        • Suchen: Z39.50, SRU/SRW, OpenSearch...
        • Einsammeln/Verteilen: OAI, ATOM, RSS...
        • Kopieren/Status: unAPI, SeeAlso, DAIA
        • ATOMPub, Shibboleth, OpenID, NCIP, SIP2 ...
      • Oft versch. Datenformate über eine API
      • Wenn keine API vorhanden: Wrapper/Scraper
      • Serviceorientierte Architektir (SOA): Netz-werk aus Diensten & gut dokumentierte APIs
      Zusammenfassung
    40. Weitere Quellen
      • Library-related APIs http://techessence.info/apis
      • DLF Working group on digital library APIs
      • Jangle Project
      • Programmable Web
      • ...
    41. Bis nächste Woche!

    + nichtichnichtich, 2 years ago

    custom

    1454 views, 1 favs, 0 embeds more stats

    Vorlesung zu Schnittstellen und Webservices im Rahm more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1454
      • 1454 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 30
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?