This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix solid: <http://www.w3.org/ns/solid/terms#>. | |
@prefix foaf: <http://xmlns.com/foaf/0.1/>. | |
@prefix pim: <http://www.w3.org/ns/pim/space#>. | |
@prefix schema: <http://schema.org/>. | |
@prefix ldp: <http://www.w3.org/ns/ldp#>. | |
<> | |
a foaf:PersonalProfileDocument ; | |
foaf:maker <https://jackson.inrupt.net/profile/card#me> ; | |
foaf:primaryTopic <https://jackson.inrupt.net/profile/card#me> . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async function getChatMessages(chatUrl) { | |
// ... | |
// Create RDFJS dataset | |
const dataset = await new Promise((resolve, reject) => { | |
const dataset = Dataset(); | |
const parserN3 = new ParserN3({ baseIRI: dataUrl }) | |
const input = new Readable({ | |
read: () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Store, Parser } from "n3"; | |
import shex from 'shex'; | |
/** | |
* Takes in a turtle representation and returns true if it is a chat | |
* @param {string} chatTtl: The turtle representation of the chat | |
* @param {string} dataUrl: The url of the file the data was at | |
* @param {string} nodeUrl: The url of the | |
* @return {boolean} true if the given data matches a chat | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async function getChatMessages(chatUrl) { | |
// ... | |
// Validate that the fetched data is a chat | |
if (!await isValidChat(chatTtl, dataUrl, nodeUrl)) { | |
alert(`Document at ${dataUrl} is not a valid chat`) | |
return null | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix : <#>. | |
@prefix mee: <http://www.w3.org/ns/pim/meeting#>. | |
@prefix terms: <http://purl.org/dc/terms/>. | |
@prefix XML: <http://www.w3.org/2001/XMLSchema#>. | |
@prefix n: <http://rdfs.org/sioc/ns#>. | |
@prefix n0: <http://xmlns.com/foaf/0.1/>. | |
@prefix c: </profile/card#>. | |
@prefix c0: <https://jackson2.inrupt.net/profile/card#>. | |
@prefix n1: <http://purl.org/dc/elements/1.1/>. | |
@prefix flow: <http://www.w3.org/2005/01/wf/flow#>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async function getChatMessages(chatUrl) { | |
// The url of the file containing the chat | |
const dataUrl = chatUrl; | |
// The url of the node within the file that is the chat | |
const nodeUrl = chatUrl; | |
// Fetch the chat using solid-auth-client | |
const chatTtl = await (await auth.fetch(dataUrl)).text() | |
console.log(chatTtl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://rawgit.com/shexSpec/shex.js/extends/packages/shex-webapp/doc/shex-simple.html?schema=PREFIX%20srs%3A%20%3Chttps%3A%2F%2Fshaperepo.com%2Fschemas%2Fchat%23%3E%0APREFIX%20xsd%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX%20mee%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Fpim%2Fmeeting%23%3E%0APREFIX%20purl%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0APREFIX%20flow%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2005%2F01%2Fwf%2Fflow%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX%20ns%3A%20%3Chttp%3A%2F%2Frdfs.org%2Fsioc%2Fns%23%3E%0APREFIX%20terms%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0APREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0APREFIX%20ic%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F12%2Fcal%2Fical%23%3E%0A%0Asrs%3AChatShape%20EXTRA%20a%20%7B%0A%20%20%20%20a%20%5B%20mee%3AChat%20%5D%3B%0A%20%20%20%20purl%3Aauthor%20IRI%3B%0A%20%20%20%20purl%3Atitle%20xsd%3Astring%3B%0A%20%20%20%20flow%3Amessage%20%40srs%3AChatMe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
var endpoint = new AWS.Endpoint('https://search-arduino-test-ybrxss46t4wvvczoi5tipwrvz4.us-west-2.es.amazonaws.com'); | |
var path = require('path'); | |
const https = require('https'); | |
var esDomain = { | |
region: 'us-west-2', | |
endpoint: 'search-arduino-test-ybrxss46t4wvvczoi5tipwrvz4.us-west-2.es.amazonaws.com/', | |
index: 'arduinoindex', | |
doctype: 'breath' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const aws = require('aws-sdk'); | |
var endpoint = new AWS.Endpoint('https://search-arduino-test-ybrxss46t4wvvczoi5tipwrvz4.us-west-2.es.amazonaws.com'); | |
exports.handler = function(event, context) { | |
var req = new AWS.HttpRequest(endpoint); | |
req.method = 'POST'; | |
req.path = path.join('/', esDomain.index, esDomain.doctype); | |
req.region = esDomain.region; | |
req.body = event; | |
req.headers['presigned-expires'] = false; |