VisualDataWeb / WebVOWL

Visualizing ontologies on the Web
http://vowl.visualdataweb.org/webvowl.html
MIT License
742 stars 214 forks source link

ServerTime not needed #158

Open madansr7 opened 5 years ago

madansr7 commented 5 years ago

Looks like the only use of servertime is to create the session id. Wondering why can we use a random generator like a Math.random() and manage using that Id? That will allow folks to point any url source (or service) that can return a Vowl formatted JSON response.

vitalis-wiens commented 5 years ago

Hi, I am not sure what you mean by 'point any url source that can return a VOWL formated JSON'

We use OWL2VOWL to parse an ontology using the OWL API and then create the VOWL JSON format which is returned to client.

So basically WebVOWL does not generate the JSON, this is happening on the server side.

madansr7 commented 5 years ago

I have a service that generates VOWL formatted JSON for an OData service. I tried pointing to the JSON directly from the UI but it seems to want to go through the OWL2VOWL converter. That's what prompted my thought.

vitalis-wiens commented 5 years ago

The question is how you point the JSON to the UI

If the your data is a json file there are two options 1) in webvowl/data there are json files, so when you load http://www.visualdataweb.de/webvowl/#foaf it will search for the file webvowl/data/foaf.json

2) you can also provide a link to the json file e.g., http://www.visualdataweb.de/webvowl/#url=http://www.visualdataweb.de/webvowl/data/goodrelations.json

There is maybe a third option If you have the JSON content loaded in the client you could create a wrapper in the loadingModule

/app/js/loadingModule.js

line 547 : function parseOntologyContent( content ){...}

the content is a parameter that holds the string representation of the content(data)

You could feed this function with your data, this function will call in the app.js this function function loadOntologyFromText( jsonText, filename, alternativeFilename ){...}

It will parse the txt to a JSON object and forward it to the graph // app.js line 423 : options.data(data); and then call the graph.load function (line 429)

madansr7 commented 5 years ago

@vitalis-wiens , thanks for the input and the quick response. I need to provide the ability to paste the odata metadata url in the "Custom Ontology section". Right now i had to override the functionality to call a custom Web API that translates an OData metadata into VOWL JSON format and returns as payload. for reference an OData metadata looks like such: https://services.odata.org/V4/(S(ndwa0dbfjadv0ayhbnloavsg))/TripPinServiceRW/$metadata

mlawry commented 5 years ago

To answer the original poster's question, it is generally not possible to "point any url source (or service) that can return a Vowl formatted JSON response" in the Web browser client using ajax due to Cross-Site Scripting (XSS) prevention. Basically, the browser will not allow JavaScript code loaded from http://www.visualdataweb.de/webvowl to get VOWL JSON from https://my.web.com/vowl.json via an ajax request.

It looks like the WebVOWL code is using ajax requests, so what they do instead is to rely on some server code to do the reading of JSON data from https://my.web.com/vowl.json, and return back the JSON read via ajax. I'm guessing the OWL2VOWL converter is used for this purpose so they don't have to invent another API for getting JSON data, even though there is really nothing to convert since the data is already JSON.

vitalis-wiens commented 5 years ago

Thanks,

exactly, we forward the JSON through the server in order to ensure that CORS does not happen.