Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of DataShare
//
// Copyright 2016 Giovanni Campagna
//
// See COPYING for details
"use strict";
const Q = require('q');
const Stream = require('stream');
const crypto = require('crypto');
const Tp = require('thingpedia');
const TripleStore = Tp.TripleStore;
const Config = require('../config');
function makeId(serial) {
var hash = crypto.createHash('md5');
hash.update(String(serial));
return hash.digest('hex').substring(0, 8);
}
class OmletStore extends TripleStore {
constructor(messaging) {
super();
this._messaging = messaging;
this._feed = null;
this._refcount = 0;
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of ThingEngine
//
// Copyright 2015 Giovanni Campagna
//
// See COPYING for details
"use strict";
const Q = require('q');
const Tp = require('thingpedia');
const Stream = require('stream');
const TripleStore = Tp.TripleStore;
const Constants = require('../../../../graphdb/constants');
const RDF_BASE = Constants.RDF_BASE;
const ME = Constants.ME;
const RDF_BASE_REGEX = Constants.RDF_BASE_REGEX;
const RDF_TYPE = Constants.RDF_TYPE;
const FOAF = 'http://xmlns.com/foaf/0.1/';
const FOAF_PERSON = FOAF + 'Person';
const FOAF_NAME = FOAF + 'name';
const FOAF_KNOWS = FOAF + 'knows';
function nonEmptyIntersection(s1, s2) {
for (var o of s1)
if (s2.has(o))
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of DataShare
//
// Copyright 2016 Giovanni Campagna
//
// See COPYING for details
"use strict";
const Q = require('q');
const fs = require('fs');
const level = require("levelup");
const levelgraph = require("levelgraph");
const Tp = require('thingpedia');
const TripleStore = Tp.TripleStore;
module.exports = class LocalTripleStore extends TripleStore {
constructor(path) {
super();
this.rdf = null;
this._path = path;
this._refcount = 0;
}
get uri() {
return 'omlet://me';
}
ref() {
this._refcount ++;
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of DataShare
//
// Copyright 2016 Giovanni Campagna
//
// See COPYING for details
"use strict";
const Q = require('q');
const Stream = require('stream');
const Tp = require('thingpedia');
const TripleStore = Tp.TripleStore;
const Config = require('../config');
const Constants = require('./constants');
const LocalStore = require('./local_store');
const OmletStore = require('./omletstore');
const UserStore = OmletStore.User;
const FeedStore = OmletStore.Feed;
const UnionStream = require('./unionstream');
class EmptyStore extends TripleStore {
constructor(uri) {
super();
this._uri = uri;
}
get uri() {