EEXCESS / c4

C4 - Cultural and sCientific Content in Context - is the EEXCESS context detection framework written in JavaScript. It provides supporting functionionality to enable easy user mining and querying for all EEXCESS clients. It supports for example Named Entity Recognition using the DOSeR Service, paragraph detection, Citation Buidling etc.
http://eexcess.eu/
1 stars 1 forks source link

C4 - Cultural and sCientific Content in Context

Installation

The simplest way is to use bower. C4 is available in the package repository, so bower install c4 will install everything you need.
After c4 is installed, you might need to configure the paths for requirejs. This can be comfortably automated with grunt-bower-requirejs. If you choose to configure the paths manually, your configuration might look similar to this (first part of the script, in which you want to use c4 modules):

requirejs.config({
  baseUrl: 'bower_components/',
  paths: {
    jquery: 'jquery/dist/jquery',
    "jquery-ui":'jquery-ui/jquery-ui',
    graph:'graph/lib/graph',
    "tag-it":'tag-it/js/tag-it'
  }
});

Once the paths are configured, you need to include your script via requirejs as usual, for example like so:

<script data-main="myScript" src="https://github.com/EEXCESS/c4/raw/master/bower_components/requirejs/require.js"></script>

where myScript is the script you want to execute and in which you use c4 modules.

Module Overview

APIconnector

The APIconnector module provides means to communicate with the (EEXCESS) Federated Recommender via the Privacy Proxy.
A working example using the APIconnector can be found in examples/searchBar_Paragraphs

paragraphDetection

A module to extract textual paragraphs from arbitrary webpage markup, find the paragraph currently in focus of the user and create a search query from a paragraph.
A working example using the paragraphDetection can be found in examples/searchBar_Paragraphs

CitationBuilder

Please see the README.md of the CitationBuilder module for details.

searchBar

A module that adds a search bar to the bottom of the page, which enables to show and modify the query and display the results.
A working example using the searchBar can be found in examples/searchBar_Paragraphs

iframes

A utility module for communicating between iframes

namedEntityRecognition

A utility module to query the EEXCESS recognition and disambiguation service

logging-API

A module that provides an API for generating logging events in the format specified by Logging Format. Logging-Events are passed over to the APIconnector which sends it to the logging endpoints of the Privacy Proxy. A working example on how the logging is to be used, can be found in examples/loggingExample.

The logging-API provides methods to create logging events in the correct format and it broadcasts these events as messages via the browser's Messaging-API. Thus, the client application needs to listen to the following messages and forward them to the Privacy Proxy:

  require(['c4/APIconnector'], function(api) {
    api.init({origin: {
      clientType: "EEXCESS Chrome extension",
      clientVersion: "2.0.1"
      userID: "93939A-8494BE-99ADF2"
      }});

    window.onmessage = function(msg) {
      if (msg.data.event) {
        switch (msg.data.event) {
          case 'eexcess.log.moduleOpened':
              api.sendLog(api.logInteractionType.moduleOpened, msg.data.data);
              break;
          case 'eexcess.log.moduleClosed':
              api.sendLog(api.logInteractionType.moduleClosed, msg.data.data);
              break;
          case 'eexcess.log.moduleStatisticsCollected':
              api.sendLog(api.logInteractionType.moduleStatisticsCollected, msg.data.data);
              break;
          case 'eexcess.log.itemOpened':
              api.sendLog(api.logInteractionType.itemOpened, msg.data.data);
              break;
          case 'eexcess.log.itemClosed':
              api.sendLog(api.logInteractionType.itemClosed, msg.data.data);
              break;
          case 'eexcess.log.itemCitedAsImage':
              api.sendLog(api.logInteractionType.itemCitedAsImage, msg.data.data);
              break;
          case 'eexcess.log.itemCitedAsText':
              api.sendLog(api.logInteractionType.itemCitedAsText, msg.data.data);
              break;
          case 'eexcess.log.itemCitedAsHyperlink':
              api.sendLog(api.logInteractionType.itemCitedAsHyperlink, msg.data.data);
              break;
          case 'eexcess.log.itemRated':
              api.sendLog(api.logInteractionType.itemRated, msg.data.data);
              break;
          default:
              break;
        }
      }
    }
  });

The methods of the logging-API are as follows:

The logging-API provides the following methods to create corresponding logging events:

The following examples demonstrate the usage of these methods:

  require(['c4/logging'], function(logging) {
      logging.init({
        origin:{
          module: "Dashboard Visualization"
        }
      });

      var queryID = "483904939"
      var documentBadge = {
        id: "995eb36f-151d-356c-b00c-4ef419bc2124",
        uri: "http://www.mendeley.com/research/hellenism-homoeroticism-shelley-circle",
        provider: "Mendeley"
      };

      logging.moduleOpened("anotherVisualizationName");
      logging.moduleClosed("anotherVisualizationName", 5000);
      logging.moduleStatisticsCollected({usageStatistics: 42});

      logging.itemOpened(documentBadge, queryID); 
      logging.itemClosed(documentBadge, queryID, 1500);

      logging.itemCitedAsImage(documentBadge, queryID);
      logging.itemCitedAsText(documentBadge, queryID);
      logging.itemCitedAsHyperlink(documentBadge, queryID);

      logging.itemRated(documentBadge, queryID, 0, 4, 3);
    });