Skip to content

Instantly share code, notes, and snippets.

View bryaakov's full-sized avatar

Yaakov Breuer bryaakov

View GitHub Profile
package controllers
import akka.stream.scaladsl.Source
import akka.util.ByteString
import com.google.inject.{Inject, Singleton}
import play.api.mvc._
import play.api.http.HttpEntity
@Singleton
class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
@bryaakov
bryaakov / https-support-in-cmwell.md
Last active September 20, 2018 08:08
HTTPS support in CM-Well: Phases

HTTPS support in CM-Well: Phases

Introduction

In RDF, all elements are URIs. The Subject is somewhat special in the eyes of CM-Well, as it is the path of the Infoton. Other elements (Predicate, Object, and Quad/Graph) are preserved as they were ingested.

  • Note this has nothing to do with the way CM-Well is communicated with. A CM-Well Cluster can live in an http endpoint and ingest data which "https" exists in payload, and vice versa.

Phase 0 - The Way It Used to Be

In order to preserve the https protocol of Subjects, we used to mangle the path of the Infoton, adding a prefix of https. before the domain. While this was fully supported, it felt "ugly" and we wanted to choose a different representation.

@bryaakov
bryaakov / flatten.json.md
Last active March 13, 2018 14:26
Flatten JSON Design

Flatten JSON

// TODO: Rename feature. Suggestion: Dynamic Nested Indexing

Abstract

  • CM-Well will allow indexing not only by Linked Data predicates, or plain field names (AKA meta/nn), but also by nested JSON attributes.
  • Those attributes will be supplied in a JSON format (see APIs below), and will be searchable using a "path" in the JSON structure (see Examples below).

APIs

  1. Indexing an Infoton with nested attributes: Upload a FileInfoton to the path of your document, with "application/x-cm-well-json" content type header.
@bryaakov
bryaakov / blp-webapp-format-query-param.md
Last active August 31, 2017 05:46
[bloop to be] FileInfotons vs WebApp

This gist will become a bloop in https://github.com/thomsonreuters/CM-Well/tree/master/blps once we have conclusions. For now this is only thoughts...

Dan pointed out (CM-Well/CM-Well#97) we have an inconsistency when navigating using a webapp to a FileInfoton and then refresh the page. First, let's agree on four axioms:

  1. SPA navigation should be aligned with browser history.
  2. An ObjectInfoton, when requested without format query parameter, is wrapped with the default webapp.
  3. A FileInfoton, when requested without format query parameter, is returned according to its mime-type ("as is"). This imatate the behavior of a "regular" webserver providing static content as files.
  4. CM-Well has two built-in webapps, one is default, but they are only FileInfotons ingested upon an install/upgrade. Anyone can upload their own webapp. In other words, the UI is pluggable.

The inconsistency was inevitable when implemeting (1) and (3) straightforward...