Das Leben der Anderen Twitter-Analyse mit Oracle12c, JSON und APEX
Carsten Czarski Business Unit Database Oracle Deutschland B.V. & Co KG
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
About: Carsten Czarski • 1973 – München – Verheiratet – zwei Kinder • ORACLE Deutschland seit 2001 – Verantwortlich für die DB Entwicklercommunity – SQL, PL/SQL, APEX; Spatial, XML DB, JSON
• Community-Arbeit – Deutschsprachige APEX Community Webseite – DOAG, ODTUG, andere
• Web 2.0 – Blog: sql-plsql-de.blogspot.com – Twitter: @cczarski Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Twitter-Analyse mit Oracle12c SQL/JSON • Twitter-Daten in die DB laden • Twitter Daten-Format verstehen
• Datenstrukturen verstehen • Oracle12c SQL/JSON verstehen
• Abfragen erstellen und Ergebnisse visualisieren
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
3
Twitter-Daten in die Datenbank laden • Verschiedene Ansätze denkbar; auch kommerzielle Anbieter
• Out-Of-The-Box-Ansatz per Twitter API
http://sql-plsql-de.blogspot.de/2015/09/twitter-analyse-mit-nichts-als.html Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
4
API-Zugang zu Twitter: apps.twitter.com
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
5
API-Zugang zu Twitter: Applikation erstellen
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
6
API-Zugang zu Twitter: Applikationsdetails
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
7
Access Tokens und Secrets
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
8
Twitter-Zugang mit Java: Twitter4j-Bibliothek
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
9
Abbildung Java-Code auf PL/SQL Funktionen
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
10
Twitter-Daten als JSON – Direkt von der Twitter API
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
11
Native JSON Unterstützung in der Oracle Datenbank JSON Dokumente speichern und verwalten • JSON als Text speichern (VARCHAR2, CLOB, BLOB) Ohne Schema - volle Flexibilität • Kein eigener Datentyp: Nutzung der Standard-Datentypen für Zeichenketten bzw. Binärdaten
• Indizierung mit einem 'JSON aware' Index
API Zugriff auf JSON • REST Services • Java API (weitere Programmiersprachen in Planung)
SQL Abfragen direkt auf JSON-Dokumente Reporting, Analyse und relationaler Zugriff direkt auf JSON-Dokumente 'JSON and SQL duality' Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
12
SQL/JSON Funktionen • JSON in Tabellen mit SQL/JSON Funktionen parsen – Externe Tabellen ebenfalls möglich – JSON-Daten auch im Hadoop Cluster oder NoSQL DB Oracle Big Data SQL
• SQL/JSON Funktionen im einzelnen – JSON_VALUE extrahiert einzelne, skalare Attribute – JSON_QUERY extrahiert JSON-Objekte (Teildokumente) – JSON_EXISTS prüft, ob das angefragte JSON-Attribut existiert – JSON_TABLE projiziert JSON-Daten als relationale Ergebnismenge – JSON_TEXTCONTAINS führt Volltextsuche in JSON-Daten durch
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
13
Beispiel: Einfache Extraktion eines Attributs select distinct json_value( tweet, '$.user.screen_name' RETURNING VARCHAR2(35) ) from apextweets; JSON_VALUE -----------------------------------------------------------------AdKosigan Enkitec berkleyp delrez_stephane :
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
14
Komplexere Analysen ...
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
15
Komplexere Analysen ...
SQL/JSON Part projects JSON attributes as a relational result.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
16
Komplexere Analysen ... "Classic" SQL aggegation
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
17
Visualisierung – am Beispiel APEX 5.0
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
18
Noch mehr Analysen ... • JSON Attribut: $.created_at
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
19
Noch mehr Analysen ... Hashtag-Kombinationen
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
20
Noch mehr Analysen ... Hashtag-Kombinationen
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
21
In Kürze erhältlich ...
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
[email protected]
http://tinyurl.com/apexcommunity http://sql-plsql-de.blogspot.com http://plsqlexecoscomm.sourceforge.net http://plsqlmailclient.sourceforge.net Twitter: @cczarski @oraclebudb Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |