Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
// tslint:disable:no-var-requires
const jsonldRdfaParser = require("jsonld-rdfa-parser");
const jsonldLib = require("jsonld");
// tslint:enable:no-var-requires
jsonldLib.registerRDFParser("text/html", jsonldRdfaParser);
import * as assert from "assert";
import * as fs from "fs";
import { ClientRequestArgs } from "http";
import * as http from "http";
import * as https from "https";
import * as path from "path";
import * as url from "url";
import { Url, UrlObject } from "url";
import * as util from "util";
import { ASLink, HttpRequestResponder } from "./types";
import { createLogger } from "../src/logger";
const logger = createLogger("util");
/**
* Return the 'first' item of the provided itemOrList.
/**
* convert schema.org raw RDFa data into compacted JSON-LD
*/
var fs = require('fs');
var path = require('path');
var jsonldRdfaParser = require('jsonld-rdfa-parser');
var jsonld = require('jsonld');
var request = require('request');
// register the parser for content type text/html
jsonld.registerRDFParser('text/html', jsonldRdfaParser);
var context = {
'@context': {
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
owl: 'http://www.w3.org/2002/07/owl#',
vs: 'http://www.w3.org/2003/06/sw-vocab-status/ns#',
xsd: 'http://www.w3.org/2001/XMLSchema#',
bibo: 'http://purl.org/ontology/bibo/',
skos: 'http://www.w3.org/2004/02/skos/core#',
dc: 'http://purl.org/dc/terms/',
schema: 'http://schema.org/',
oa: 'http://www.w3.org/ns/oa#',
sameAs: {
'@id': 'owl:sameAs',