Coder Social home page Coder Social logo

rdf-ext's Introduction

rdf-ext

build status npm version

RDF-Ext is a JavaScript library that extends the RDF/JS specs to handle RDF data in a developer-friendly way.

Install

npm install --save rdf-ext

Usage

Just import the default export from the package:

import rdf from 'rdf-ext'

const term = rdf.namedNode('http://example.org/')

The exported object is an instance of @rdfjs/environment. The following factories are included in the environment:

Experimental features

The package contains experimental features which may break or be removed without being covered in the semantic versioning:

Documentation & examples

For more details, please check rdf-ext.org

rdf-ext's People

Contributors

bergos avatar jcoyne avatar ktk avatar l00mi avatar nicola avatar retog avatar sylvainlb avatar tomasklapka avatar vhf avatar woutermont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdf-ext's Issues

I have a problem...

It appears to be running ok in browser now, but I keep getting "input.on is not a function". I also tried N3.js directly, same problem. Any suggestions?

N00bs questions

Sorry, this is not exactly an issue but I didn't know where to ask those questions.

First, just know that I am mostly a n00b with Javascript. More exactly, that I don't have any experience with Node.js, nor with JS libraries relying on some Node.js toolchain.

First, I am not sure where to find the main rdf-ext.js library. I guess it's not that one? Do I need to build the library myself? How?

I have the same questions with the dependencies. For example, the README mentions N3.js. But I don't see it anywhere under lib. Do I need to pull manually that dependency? How do I know about which version is supported? What about the other files under lib?

About the documentation: I have seen http://bergos.github.io/rdf-ext-spec/ and I think I can read WebIDL. But in the example you added today, you used parseTurtle, which I don't find in the main specification. I guess it's somewhat related to DataParser? In any case, I am mostly interested in RDF parsers that can eagerly react on triples instead of the complete graph if that's available (we have our own Graph implementation in banana-rdf). Maybe it's the ProcessorCallback thing? I couldn't find its definition in the spec.

At this point, I would appreciate a few notes on how to get started with rdf-ext in the browser, with the examples you just added, and starting from a blank project. Thanks again for everything: I really want to use rdf-ext from banana-rdf :-) To get an idea of what I am doing, you can look at banana-rdf/banana-rdf#219 .

Todo list for 0.3.0 release

Auto-resolve CURIEs on NamedNode creation

Hi,

I noticed that when creating a new named node for a CURIE (e.g. via rdf.createNamedNode(curieString)), I must use rdf.resolve before to resolve the CURIE to an URI; otherwise it seems to me that RDF-Ext thinks the CURIE is an URI:

<#me> <foaf:mbox> <mailto:...> .
vs.
<#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:...> .

Maybe RDF-Ext could check if a CURIE is passed to the rdf.NamedNode constructor and call resolve automatically? According to the RDF Interfaces Spec [1], CURIEs may be passed without further care.

[1] https://www.w3.org/TR/rdf-interfaces/#widl-RDFEnvironment-createNamedNode-NamedNode-DOMString-value

Best regards, Chris

Use request instead

Can we just use request ?

This current implementation does not follow redirects, for example.
It looks to me we are just reimplementing requests, which shouldn't be much big of a dependency

Test fails: Turtle serializer should generate parsable card

See travis#3

Error: Expected prefix to follow @prefix at line 9.
      at Object.N3Parser._error (/Users/mozilla/Proj/gits/rdf-ext/node_modules/n3/lib/N3Parser.js:570:20)
      at Object.N3Parser._readPrefix (/Users/mozilla/Proj/gits/rdf-ext/node_modules/n3/lib/N3Parser.js:488:19)
      at /Users/mozilla/Proj/gits/rdf-ext/node_modules/n3/lib/N3Parser.js:619:35
      at Object.N3Lexer._tokenizeToEnd (/Users/mozilla/Proj/gits/rdf-ext/node_modules/n3/lib/N3Lexer.js:284:7)
      at Object._onImmediate (/Users/mozilla/Proj/gits/rdf-ext/node_modules/n3/lib/N3Lexer.js:340:38)
      at processImmediate [as _immediateCallback] (timers.js:354:15)

language tags lost after JSON-LD parse + serialize

I work with this example:
http://jasnell.github.io/w3c-socialwg-activitystreams/activitystreams2.html

using context:
https://github.com/jasnell/w3c-socialwg-activitystreams/blob/65784962263f606c70fe2ba5745c1dcf4c068ae3/activitystreams2-context.jsonld

after

 new rdf.JsonLdParser().parse(helper.getExample('example-3'), function(example){
          console.log(rdf.serializeJsonLd(example))
});

includes

'http://activitystrea.ms/2.0/displayName': 
     [ 'Martin posted a new video to his album.',
       'Martin phost le fisean nua a albam.' ]

where original example has

"displayName": {
        "en": "Martin posted a new video to his album.",
        "ga": "Martin phost le fisean nua a albam."
      }

and context includes

 "displayName": {
     "@id": "as:displayName",
     "@container": "@language"
   }

JsonLdParser "@container": "@list" Uncaught TypeError

i don't have time to investigate so i report very quickly apologies!
trying to parse JSON-LD as in

http://json-ld.org/playground/#/gist/dd7b8aa090f107970376

i endup with

 Uncaught TypeError: Cannot call method 'toString' of undefined
      at new rdf.Literal (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-interfaces/rdfi.js:129:146)
      at Object.defineProperties.createLiteral.value [as createLiteral] (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-interfaces/rdfi.js:377:16)
      at getLiteral (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:79:18)
      at processObject (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:152:14)
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:136:11
      at Array.forEach (native)
      at processPredicate (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:132:16)
      at processSubject (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:127:9)
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:161:9
      at Array.forEach (native)
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:160:14
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/lib/jsonld-parser.js:32:9
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:438:7
      at cleanup (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:231:5)
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:164:7
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:1925:5
      at finished (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:6177:7)
      at _retrieveContextUrls.retrieve (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:6183:7)
      at _retrieveContextUrls (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:6282:3)
      at Function.jsonld.processContext (/cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:1915:3)
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:149:12
      at /cache/code/w3c/w3c-socialwg-activitystreams/node_modules/rdf-ext/node_modules/jsonld/js/jsonld.js:133:16
      at process._tickCallback (node.js:415:13)

you could also try uncomment elf-pavlik/w3c-socialwg-activitystreams@f1d5865#diff-03d2e724d369f2635fc123f85d486fbbR145
and run

npm install
./node_modules/.bin/mocha -g ordered test

when i remove this line it doesn't crash!
https://github.com/elf-pavlik/w3c-socialwg-activitystreams/blob/f1d58658f5165d07bd2b1277401453da21c869a1/activitystreams2-context.jsonld#L233

Decoupling Stores from the library and repo

I find this work really clever, and I want to be using this in my future rdf projects.

However, most of the fiddling I have been doing has been in the browser, and I hate load the ENTIRE library (after browserifying it) to only get one of the stores (in-memory store).

The purpose of this library should be to provide help for others to write their own stores and not really ship different implementations (or at least they should be shipped in different packages).

So I did the following. I packaged every store I have seen online, in this repo and in others - so that other users can just require what they want (the node spirit, no?):

In this way, we don't only decouple the code of different implementation from the library and this repo, but we also foster a whole new community of developers writing their own rdf-store packages - maybe a MongoDB one ? (that I actually need)

I am happy to work out a PR that would remove all the code in rdf-ext, add you guys in the repos and npm packages and/or move these packages under /rdf-js

Ciao

createLiteral or createTriple cannot handle non-string values

I run into an issue while generating triples with a non-string value as literal.

I use the following code (simplifyed):

var bnode = rdf.createBlankNode();

var pgeolat = rdf.createNamedNode('https://schema.org/latitude');
var pgeolong = rdf.createNamedNode('https://schema.org/longitude');

var ogeolat = rdf.createLiteral(geoaddress.value[0].latitude, null, 'http://www.w3.org/2001/XMLSchema#float');
var ogeolong = rdf.createLiteral(geoaddress.value[0].longitude, null, 'http://www.w3.org/2001/XMLSchema#float');

var tlat = rdf.createTriple(bnode, pgeolat, ogeolat);
var tlong = rdf.createTriple(bnode, pgeolong, ogeolong);

This results in incomplete triples:

_:b18 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org/GeoCoordinates> .
_:b18 <https://schema.org/latitude> ""^^<http://www.w3.org/2001/XMLSchema#float> .
_:b18 <https://schema.org/longitude> ""^^<http://www.w3.org/2001/XMLSchema#float> .

After analyzing what's going on I come to the following conclusion:

  • creating a literal from a string works
  • creating a literal from a JavaScript datatype which is not a string does not work (did not do much tests though)

I'm not sure if it is going wrong in createLiteral or in createTriple, the output of the triple looks like this in JSON:

{
    "interfaceName": "Literal",
    "nominalValue": 45.91907,
    "language": null,
    "datatype": {
        "interfaceName": "NamedNode",
        "nominalValue": "http://www.w3.org/2001/XMLSchema#float"
    }
}

blank node identifiers missing _:

after parsing rdf.TurtleParser().parse()

_:b0 <http://activitystrea.ms/2.0/actor> <urn:example:person:martin> .
_:b0 <http://activitystrea.ms/2.0/object> <http://example.org/foo.jpg> .
_:b0 <http://activitystrea.ms/2.0/verb> _:b1 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://activitystrea.ms/2.0/Activity> .

and serializing with rdf.serializeJsonLd() i got

[ { '@id': 'b1',
    'http://activitystrea.ms/2.0/actor': { '@id': 'urn:example:person:martin' },
    'http://activitystrea.ms/2.0/object': { '@id': 'http://example.org/foo.jpg' },
    'http://activitystrea.ms/2.0/verb': { '@id': 'b2' },
    '@type': [ 'http://activitystrea.ms/2.0/Activity' ] } ]

Simple Graph creation and operation

var rdf = require('rdf-ext')()
var graph = rdf.createGraph()
graph.add('', 'http://www.w3.org/ns/posix/stat#size', 12)

am I doing something wrong?

Users/mozilla/Proj/gits/folder-to-rdf/node_modules/rdf-ext/node_modules/rdf-interfaces/rdfi.js:158
        this._spo[t.s.h] || (this._spo[t.s.h] = {});
                     ^
TypeError: Cannot read property 'h' of undefined
    at Object.defineProperties.add.value [as add] (/Users/mozilla/Proj/gits/folder-to-rdf/node_modules/rdf-ext/node_modules/rdf-interfaces/rdfi.js:158:22)
    at Object.<anonymous> (/Users/mozilla/Proj/gits/folder-to-rdf/test.js:3:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3

Resolving url paths

I am playing around with rdf-ext, it is very cool and intuitive, congrats!

I have the following graph at url https://nicola.databox.me/profile/card

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<>
    <http://purl.org/dc/terms/title> "Nicola's Profile" ;
    a <http://xmlns.com/foaf/0.1/PersonalProfileDocument> ;
    <http://xmlns.com/foaf/0.1/primaryTopic> <#me> .

<#me>
    a <http://xmlns.com/foaf/0.1/Person> ;
    <http://www.w3.org/ns/auth/cert#key> <#key> ;
    <http://www.w3.org/ns/pim/space#preferencesFile> <../Preferences/prefs> .

Now, when I do:

graph.match('https://nicola.databox.me/profile/card','http://www.w3.org/ns/pim/space#preferencesFile')

It returns:

https://nicola.databox.me/profile/../Preferences/prefs 

Is it possible to resolve the paths in the library?

E.g.

https://nicola.databox.me/Preferences/prefs 

clownface

Reto mentioned clownface in passing, without telling me what it is. I've found clownface.js, but remain pretty clueless. Could you please explain..?

Provide docs (specs do not count)

Based on @semanticfire comments we need some better documentation for RDF-Ext to lower the entrance barrier for new programmers. Suggestions welcome, he mentions JQuery API doc as one example which does this well.

SparqlStore and arbitrary SPARQL (SELECT) queries

Hi,

as far as I saw, the current SparqlStore implementation does not allow to execute arbitrary SPARQL queries at the moment. It would be useful though if rdf-ext's SparqlStore implementation supports executing arbitrary SPARQL queries given as query string on the remote SPARQL endpoint. I think that rdf-ext should support at least arbitrary SELECT queries.

What do you think about this idea? cc @bergos

Kind regards,
Chris

where is browserified version?

I'm guessing just a doc issue.

In the readme -
[[
Browser - Just import RDF-Ext

<script src="/js/rdf-ext.js"></script>

]]

But the version in the root dir has lots of require()s in it, and the version in rdf-ext/bin/ starts with:

!/usr/bin/env node

Suggestions?

Provide a rapper-like command line utility

Initial features which would be nice:

  • Parse any of the input serializations supported by rdf-ext (-i serialization)
  • Provide any of the supported output serializations (-o serialization)
  • takes local files or URIs as input

I would recommend to be close to the rapper syntax, which is pretty straight forward.

The reason why I would like to have this is mainly because rapper is not supporting JSON-LD, which becomes a bit annoying nowadays.

Allow to create blank nodes with custom label

Hi,

I currently use SparqlHttp (SparqlStore's client property) to issue a SELECT query. The SPARQL endpoint (DBPedia) returns its results (more or less) according to the SPARQL 1.1 Query Results JSON Format Spec [1] which allows to return a label for a blank node. I've written a small parser implementation for it which may only create a blank node without a label. What about extending the rdf.BlankNode constructor by an optional label? For example:

rdf.BlankNode = function (label) {
    this.interfaceName = 'BlankNode'
    if (label != null) { // checks for null and undefined
        this.nominalValue = label
    } else {
        this.nominalValue = 'b' + (++rdf.BlankNode.nextId)
    }
};

[1] https://www.w3.org/TR/sparql11-results-json/

BR, Chris

Implement SyncStore

Create a RDF-Ext Store implementation which caches graphs in memory or Web Storage and manually forwards changes to another RDF-Ext Store. Offline Web application features can be added very easy this way.

What is the right technique to parse RDF/XML that contains ref:ParseType="Literal"

Hello Bergos

With a RDF/XML content that contains ref:ParseType="Literal" , Can you suggest the right technique for parsing RDF/XML that contains ref:ParseType="Literal"?

With my test data as posted on this message, I try to parse it by accessing "Gain" value with data.object.nominalValue.lastChild.nodeValue Is it the right technique with your library design?

I cannot find supported documentation on this issue. If you have suggestion , please advise. I posted complete of code, test data, and console output as follow.

Thank you ,
Vorachet Jaroensawas

// My code

theRdfXmlParser.parse(sample_simulinkblocks_in_rdf, function(graph) {

graph.forEach(function(data){
    console.log('------------- graph.forEach  -----------');
    console.log('subject toString(): ' + data.subject.toString());
    console.log('predicate toString(): ' + data.predicate.toString());
    console.log('object toString(): ' + data.object.toString());
    console.log('subject nominalValue: ' + data.subject.nominalValue);
    console.log('predicate nominalValue: ' + data.predicate.nominalValue);
    console.log('object nominalValue: ' + data.object.nominalValue);

    if (typeof data.object.nominalValue == 'string' || data.object.nominalValue instanceof String) {                
        // Do nothing 
        console.log('data.object.nominalValue is string"');
    }else{
        console.log('Detected rdf:parseType="Literal"');
        console.log(data.object.nominalValue);  // <--- It will print array in console

                    //  I try to access "Gain" value with data.object.nominalValue.lastChild.nodeValue 

    }

});

});

// Test RDF/XML Data

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:simulink_block="http://mathworks.com/simulink/rdf#Block/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >

    <rdf:Description rdf:about="http://localhost/test/Subsystem:Gain">        
        <rdf:type rdf:resource="http://mathworks.com/simulink/rdf#Block"/>
        <simulink_block:parameter rdf:resource="http://localhost/test//Subsystem1::Gain::RndMeth"/>
        <simulink_block:name rdf:parseType="Literal">Gain</simulink_block:name>
        <simulink_block:type rdf:parseType="Literal">Gain</simulink_block:type>
    </rdf:Description>

</rdf:RDF>

// Some console output as captured in graph.forEach() loop.

------------- graph.forEach -----------
subject toString(): http://localhost/test/Subsystem:Gain
predicate toString(): http://www.w3.org/1999/02/22-rdf-syntax-ns#type
object toString(): http://mathworks.com/simulink/rdf#Block
subject nominalValue: http://localhost/test/Subsystem:Gain
predicate nominalValue: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
object nominalValue: http://mathworks.com/simulink/rdf#Block
data.object.nominalValue is string"
------------- graph.forEach -----------
subject toString(): http://localhost/test/Subsystem:Gain
predicate toString(): http://mathworks.com/simulink/rdf#Block/parameter
object toString(): http://localhost/test//Subsystem1::Gain::RndMeth
subject nominalValue: http://localhost/test/Subsystem:Gain
predicate nominalValue: http://mathworks.com/simulink/rdf#Block/parameter
object nominalValue: http://localhost/test//Subsystem1::Gain::RndMeth
data.object.nominalValue is string"
------------- graph.forEach -----------
subject toString(): http://localhost/test/Subsystem:Gain
predicate toString(): http://mathworks.com/simulink/rdf#Block/name
object toString(): <simulink_block:name>Gain</simulink_block:name>
subject nominalValue: http://localhost/test/Subsystem:Gain
predicate nominalValue: http://mathworks.com/simulink/rdf#Block/name
object nominalValue: <simulink_block:name>Gain</simulink_block:name>
Detected rdf:parseType="Literal"
{ _nsMap: {},
attributes:
{ '0':
{ ownerDocument: [Object],
nodeName: 'rdf:parseType',
name: 'rdf:parseType',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
specified: true,
prefix: 'rdf',
localName: 'parseType',
nodeValue: 'Literal',
value: 'Literal',
ownerElement: null },
_ownerElement: [Circular],
length: 0 },
childNodes:
{ '0':
{ ownerDocument: [Object],
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 6,
columnNumber: 54 },
length: 1 },
ownerDocument:
{ doctype: null,
implementation: { _features: {} },
childNodes: { '0': [Object], '1': [Object], length: 2 },
documentURI: undefined,
firstChild:
{ ownerDocument: [Circular],
target: 'xml',
tagName: 'xml',
data: 'version="1.0" encoding="UTF-8"',
nodeValue: 'version="1.0" encoding="UTF-8"',
lineNumber: 1,
columnNumber: 1,
previousSibling: null,
nextSibling: [Object],
parentNode: [Circular] },
lastChild:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Circular],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Circular],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] },
_inc: 37,
documentElement:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Circular],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Circular],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] } },
nodeName: 'simulink_block:name',
tagName: 'simulink_block:name',
namespaceURI: 'http://mathworks.com/simulink/rdf#Block/',
prefix: 'simulink_block',
localName: 'name',
parentNode:
{ _nsMap: {},
attributes: { '0': [Object], _ownerElement: [Circular], length: 0 },
childNodes:
{ '0': [Object],
'1': [Object],
'2': [Object],
'3': [Object],
'4': [Object],
'5': [Circular],
'6': [Object],
'7': [Object],
'8': [Object],
length: 9 },
ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Object],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] },
previousSibling:
{ ownerDocument: [Object],
data: '\n\n ',
nodeValue: '\n\n ',
length: 6,
parentNode: [Object],
previousSibling: null,
nextSibling: [Circular],
lineNumber: 2,
columnNumber: 57 },
nextSibling:
{ ownerDocument: [Object],
data: '\n\n',
nodeValue: '\n\n',
length: 2,
parentNode: [Object],
previousSibling: [Circular],
nextSibling: null,
lineNumber: 8,
columnNumber: 23 },
lineNumber: 3,
columnNumber: 5,
firstChild:
{ ownerDocument: [Object],
data: '        \n        ',
nodeValue: '        \n        ',
length: 17,
parentNode: [Circular],
previousSibling: null,
nextSibling: [Object],
lineNumber: 3,
columnNumber: 71 },
lastChild:
{ ownerDocument: [Object],
data: '\n ',
nodeValue: '\n ',
length: 5,
parentNode: [Circular],
previousSibling: [Object],
nextSibling: null,
lineNumber: 7,
columnNumber: 80 } },
previousSibling:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: '\n        ',
nodeValue: '\n        ',
length: 9,
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Object],
lineNumber: 3,
columnNumber: 5,
firstChild: [Object],
lastChild: [Object] },
previousSibling:
{ _nsMap: {},
attributes: [Object],
childNodes: {},
ownerDocument: [Object],
nodeName: 'simulink_block:parameter',
tagName: 'simulink_block:parameter',
namespaceURI: 'http://mathworks.com/simulink/rdf#Block/',
prefix: 'simulink_block',
localName: 'parameter',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Circular],
lineNumber: 5,
columnNumber: 9 },
nextSibling: [Circular],
lineNumber: 5,
columnNumber: 100 },
nextSibling:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: '\n ',
nodeValue: '\n ',
length: 9,
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Object],
lineNumber: 3,
columnNumber: 5,
firstChild: [Object],
lastChild: [Object] },
previousSibling: [Circular],
nextSibling:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'simulink_block:type',
tagName: 'simulink_block:type',
namespaceURI: 'http://mathworks.com/simulink/rdf#Block/',
prefix: 'simulink_block',
localName: 'type',
parentNode: [Object],
previousSibling: [Circular],
nextSibling: [Object],
lineNumber: 7,
columnNumber: 9,
firstChild: [Object],
lastChild: [Object] },
lineNumber: 6,
columnNumber: 80 },
lineNumber: 6,
columnNumber: 9,
firstChild:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 6,
columnNumber: 54 },
lastChild:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 6,
columnNumber: 54 } }
------------- graph.forEach -----------
subject toString(): http://localhost/test/Subsystem:Gain
predicate toString(): http://mathworks.com/simulink/rdf#Block/type
object toString(): <simulink_block:type>Gain</simulink_block:type>
subject nominalValue: http://localhost/test/Subsystem:Gain
predicate nominalValue: http://mathworks.com/simulink/rdf#Block/type
object nominalValue: <simulink_block:type>Gain</simulink_block:type>
Detected rdf:parseType="Literal"
{ _nsMap: {},
attributes:
{ '0':
{ ownerDocument: [Object],
nodeName: 'rdf:parseType',
name: 'rdf:parseType',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
specified: true,
prefix: 'rdf',
localName: 'parseType',
nodeValue: 'Literal',
value: 'Literal',
ownerElement: null },
_ownerElement: [Circular],
length: 0 },
childNodes:
{ '0':
{ ownerDocument: [Object],
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 7,
columnNumber: 54 },
length: 1 },
ownerDocument:
{ doctype: null,
implementation: { _features: {} },
childNodes: { '0': [Object], '1': [Object], length: 2 },
documentURI: undefined,
firstChild:
{ ownerDocument: [Circular],
target: 'xml',
tagName: 'xml',
data: 'version="1.0" encoding="UTF-8"',
nodeValue: 'version="1.0" encoding="UTF-8"',
lineNumber: 1,
columnNumber: 1,
previousSibling: null,
nextSibling: [Object],
parentNode: [Circular] },
lastChild:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Circular],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Circular],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] },
_inc: 37,
documentElement:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Circular],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Circular],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] } },
nodeName: 'simulink_block:type',
tagName: 'simulink_block:type',
namespaceURI: 'http://mathworks.com/simulink/rdf#Block/',
prefix: 'simulink_block',
localName: 'type',
parentNode:
{ _nsMap: {},
attributes: { '0': [Object], _ownerElement: [Circular], length: 0 },
childNodes:
{ '0': [Object],
'1': [Object],
'2': [Object],
'3': [Object],
'4': [Object],
'5': [Object],
'6': [Object],
'7': [Circular],
'8': [Object],
length: 9 },
ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:RDF',
tagName: 'rdf:RDF',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'RDF',
previousSibling: [Object],
nextSibling: null,
parentNode: [Object],
lineNumber: 2,
columnNumber: 1,
firstChild: [Object],
lastChild: [Object] },
previousSibling:
{ ownerDocument: [Object],
data: '\n\n ',
nodeValue: '\n\n ',
length: 6,
parentNode: [Object],
previousSibling: null,
nextSibling: [Circular],
lineNumber: 2,
columnNumber: 57 },
nextSibling:
{ ownerDocument: [Object],
data: '\n\n',
nodeValue: '\n\n',
length: 2,
parentNode: [Object],
previousSibling: [Circular],
nextSibling: null,
lineNumber: 8,
columnNumber: 23 },
lineNumber: 3,
columnNumber: 5,
firstChild:
{ ownerDocument: [Object],
data: '        \n        ',
nodeValue: '        \n        ',
length: 17,
parentNode: [Circular],
previousSibling: null,
nextSibling: [Object],
lineNumber: 3,
columnNumber: 71 },
lastChild:
{ ownerDocument: [Object],
data: '\n ',
nodeValue: '\n ',
length: 5,
parentNode: [Circular],
previousSibling: [Circular],
nextSibling: null,
lineNumber: 7,
columnNumber: 80 } },
previousSibling:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: '\n ',
nodeValue: '\n ',
length: 9,
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Object],
lineNumber: 3,
columnNumber: 5,
firstChild: [Object],
lastChild: [Object] },
previousSibling:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'simulink_block:name',
tagName: 'simulink_block:name',
namespaceURI: 'http://mathworks.com/simulink/rdf#Block/',
prefix: 'simulink_block',
localName: 'name',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Circular],
lineNumber: 6,
columnNumber: 9,
firstChild: [Object],
lastChild: [Object] },
nextSibling: [Circular],
lineNumber: 6,
columnNumber: 80 },
nextSibling:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: '\n ',
nodeValue: '\n ',
length: 5,
parentNode:
{ _nsMap: {},
attributes: [Object],
childNodes: [Object],
ownerDocument: [Object],
nodeName: 'rdf:Description',
tagName: 'rdf:Description',
namespaceURI: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
prefix: 'rdf',
localName: 'Description',
parentNode: [Object],
previousSibling: [Object],
nextSibling: [Object],
lineNumber: 3,
columnNumber: 5,
firstChild: [Object],
lastChild: [Circular] },
previousSibling: [Circular],
nextSibling: null,
lineNumber: 7,
columnNumber: 80 },
lineNumber: 7,
columnNumber: 9,
firstChild:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 7,
columnNumber: 54 },
lastChild:
{ ownerDocument:
{ doctype: null,
implementation: [Object],
childNodes: [Object],
documentURI: undefined,
firstChild: [Object],
lastChild: [Object],
_inc: 37,
documentElement: [Object] },
data: 'Gain',
nodeValue: 'Gain',
length: 4,
parentNode: [Circular],
previousSibling: null,
nextSibling: null,
lineNumber: 7,
columnNumber: 54 } }

support prefix mapping in JSON-LD

Please add support to map the @context prefix mapping to the internal prefix mapping.

by using all names from values in @context which end with either '/' or '#' you'll get the full list of JSON-LD supplied prefix mappings.

Cannot redefine property: createGraph

I believe you're aware of this; the createGraph property of rdf-interface is not writable and leads to an error when you try to redefine it to createGraphExt. This can be confusing for some users. Maybe you can include a modified version in your repository.

Triple Stream API

We should define an parser/serializer API to stream Triples. The N3.js library would support that feature already.

Promise API

Stores, parsers and serializers should provide a Promise API out of the box.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.