Top Banner
Developer Network INTRODUCTION
13

SgCodeJam24 Workshop Extract

Nov 01, 2014

Download

Technology

remko caprio

An extract of the full deck of the SgCodeJame24 Workshop about SciVerse and OpenSocial platform and applications
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SgCodeJam24 Workshop Extract

Developer Network

INTRODUCTION

Page 2: SgCodeJam24 Workshop Extract

Developer NetworkElsevier and SciVerse

Elsevier publishes 25% of the world’s Scientific, Technical and Medical (STM) content, with more than 10 million full-text articles from 2600 journals in ScienceDirect, and more than 40 million abstracts and author, affiliation information in Scopus. In SciVerse Hub you can access all content from Elsevier plus scientific content from the web.

SciVerse lets you embed applications within the content, giving developers and apps access to framework and content APIs.

SciVerse is an extension of Apache Shindig, an implementation of OpenSocial. Sciverse apps can access content via APIs.

Keywords: Services Oriented Architecture (SOA)Web 2.0Cloud based computingDistributed ServicesWeb ServicesOpen DataREST OAuth

Page 3: SgCodeJam24 Workshop Extract

Developer NetworkElsevier SciVerse – science, there’s an app for that

iPhone Apps1 billion downloads350,000 apps

Facebook Apps500 million users

Browser Apps

Page 4: SgCodeJam24 Workshop Extract

Developer NetworkElsevier | Developer Network

Hub Search Results with SciVerse APPS (search result analysis app)

Page 5: SgCodeJam24 Workshop Extract

Developer Network

PART 1 – TECHNOLOGY PLATFORM

Page 6: SgCodeJam24 Workshop Extract

Developer NetworkOpenSocial Architecture

Shindig Server

HTTP SERVER

Gadget Renderer Servlet

Gadget Server

Gadget

Data Handler

Data Service Servlet

People

Activities

App Data

Javascript Libraries

Gadget.xml

DB1

IFRAMEhttp

request

DB2

Container

Apache Shindig is an implementation of the OpenSocial specification.

Page 7: SgCodeJam24 Workshop Extract

Developer Network

7

SciVerse – Integration Points

view Integration point

profile Hub- Home page, Search Results pageScienceDirect- Full Text Article page, Search Results pageScopus- Record page

canvas New full page

sciverseResults View

Hub- Search Results page (under each result)ScienceDirect- Search Results page (under each result)

hover Hub- Home page, Search Results pageScienceDirect- Search Results page, Full Text Article pageScopus- Search Results page, Record page, Author Details page

Apps appear as iframes in so-called views or integration points in the webpage.

Page 8: SgCodeJam24 Workshop Extract

Developer NetworkOpenSocial Gadgets What is a Gadget? The IFRAME Revolution

A gadget is a client-side application in the form of an HTML iFrame that appears in the context of a webpage and uses client-side scripting languages like JavaScript.

IFRAME<iframe src="iframe1.html" width=“400" height=“200">Hello World!</iframe>

GADGET.XML (example 1)<?xml version="1.0" encoding="UTF-8"?><Module> <ModulePrefs title=“HellowWorld1" author_email=“[email protected]"> <Require feature="opensocial-0.9" /> </ModulePrefs> <Content type="html" view="profile"><![CDATA[ <script type=‘text/javascript’>

function fnWrite() { getElementById(‘content-div’).innerHTML = “Hello World”;}

</script> <div id=‘content-div’></div> ]]></Content></Module>

Page 9: SgCodeJam24 Workshop Extract

Developer Network

PART 2 – GADGET PROGRAMMING

Page 10: SgCodeJam24 Workshop Extract

Developer NetworkSciVerse APIs

There are two main APIs for SciVerse:1. Framework API – with access to context and methods on the page2. Content API – for search and retrieval of articles, authors and affiliations

Page 11: SgCodeJam24 Workshop Extract

Developer NetworkSciVerse – Framework API - ContextInfo

Most of the information visible on the page, is accessible by the gadget via the Framework API. The ContextInfo object returns among other the following information:

accountId, artNum, au1, au1First, au1Init, au1Suffix, au1Sur, auCorp, authorKeywords, date, docTitle, doi, entitlement, genre, indexTerms, individualUser, isbn, issn, issue, keywords, offset, originPage, otherKeywords, pageContentDivTagName, pages, pageType, part, partTitle, partValue, pii, platform, scDocId, scopusFlag, searchQuery, searchTerms, secureAuthToken, sortOrder, sPage, srcTitle, ssn, timestamp, volume, year

// retrieving the authToken via the GetContextInfo method’s callbackfunction getContextInfoCallback(result){ // get authtoken for content API call var authtoken = result.secureAuthtoken; var searchterm = result.searchTerms;}

// retrieving the authToken via the gadget preferences<script type="text/javascript"> var prefs = new gadgets.Prefs(); var authToken = prefs.getString("secureAuthtoken");                               </script>

Page 12: SgCodeJam24 Workshop Extract

Developer NetworkExample - How to retrieve the authToken for the Content API call?

function init(){ gadgets.sciverse.getContextInfo(getContextInfoCallback); // this parameter is the callback method}function getContextInfoCallback(result){ // get authtoken for content API call var authtoken = result.secureAuthtoken; var searchterm = result.searchTerms;}// after pageload finishes, this executes the init method, which will trigger following functionsgadgets.util.registerOnLoadHandler(init);

OR

<UserPref name="contentApiKey" datatype="hidden" default_value="your-api-key-here" /> <UserPref name="secureAuthtoken" datatype="hidden" /> …<script type="text/javascript"> var prefs = new gadgets.Prefs(); var authToken = prefs.getString("secureAuthtoken"); </script>

Also, see the example code at https://github.com/sciversedev/examples/

Page 13: SgCodeJam24 Workshop Extract

Developer NetworkVIEWS and FIELDS

The {content-category} identifies the type of content. This is divided into:article–Serial and non-serial full text documents from journals and books published by Elsevierabstract– Abstracts from Scopusauthor– Author profiles generated from Scopus data.affiliation – Affiliation profiles generated from Scopus data.

The {identifier_label} distinguishes the type of identifier :DOI - for full-text documents, SCOPUS_ID, AUTHOD_ID - Elsevier identifier tied to an individual author, AFFIL_ID -Elsevier identifier tied to an institution (for use as an affiliation)

Other available unique identifiers available for use:PII - Publisher Item Identifier , PUBMED_ID