rdf-ext-archive / discussions

This repo is for discussions all over the rdf-ext project
3 stars 2 forks source link

Load prefixes from JSON-LD @context #26

Open semanticfire opened 7 years ago

semanticfire commented 7 years ago

If the context of a JSON-LD file contains prefixes add them to the prefixes of the store

for an older version:


// load prefixes of data elements
var context = data['@context'];
$.each(context, function(key, value) {
    if (typeof value == "string" ) {
        if(value.slice(-1)=='#' || value.slice(-1) == '/')
            rdf.prefixes[key] = value;
        }
    }); 
elf-pavlik commented 7 years ago

What happens when two different contexts of two different JSON-LD documents have colliding prefix definitions?

semanticfire commented 7 years ago

Good point, make it optional

bergos commented 7 years ago

@semanticfire why the if(value.slice(-1)=='#' || value.slice(-1) == '/')? I made this commit.

semanticfire commented 7 years ago

There can be none namespaces in the prefixes as well, or are you tackling that internally already ?