Skip to content

Experiments

RobinFrugte97 edited this page Nov 8, 2019 · 9 revisions

Datacleaning

I started cleaning the survey data from CMD. I tried loading in a csv file with d3.csv but I ran into some issues.

d3.csv("https://gist.github.com/RobinFrugte97/a5e17cb2420bb1a671ff3912fb1d8cda")
    .then((data) => console.log(data))

First I tried loading in the data from my csv hosted on a gist on Github. I got an error related to gist, so I put the csv file locally.


SPARQL data

I am fetching my SPARQL query data with an asynchoronous function;

async function runQuery(queryUrl, query){
    let getData = await fetch(queryUrl+"?query="+ encodeURIComponent(query) +"&format=json")
    let responseData = await getData.json()
    let data = responseData.results.bindings
    console.log(data)
    return data
}

I await the fetch results before I put it in a variable and turn it into JSON.

Clone this wiki locally