Git Product home page Git Product logo

alrescha's People

Contributors

marrus-sh avatar

Watchers

 avatar  avatar

alrescha's Issues

Turtle output

.toTurtle() should produce smaller output than .toNT().

Validate datatypes and return .nominalValue when invalid

(This is not a priority.)

Ideally, Al·rishāʼ would validate the .nominalValue of a Literal before converting it using [Symbol.toPrimitive] or .valueOf(). If the .nominalValue is not in the lexical space for its .datatype, the string value of the .nominalValue should be returned instead. This would make it easy to check if a Literal is valid, by testing the return type of these functions.

Opinionated RDF/XML output

Al·rishāʼ needs to be able to output RDF/XML in a format that it is easy to design XSLT stylesheets for. This likely means passing in a list of preferred starting points, and walking the graph from those starting points until another starting point of higher precedence is reached, and then finally outputting any resources which have yet to be read. This can be facilitated by a Map which clones its keys from the Graph’s resource map and whose values are simply true/false about whether a resource has yet been output.

Migrate to deno

Drop support for Node imports (if applicable) and switch testing over to Deno’s builtin testing framework.

Better “IRI” handling

In actuality, NamedNodes should probably not be mandated to be actual IRIs, provided they follow the Turtle grammar (i.e., ([^#x00-#x20<>"{}|^`\] | UCHAR)*). For property access, it would be nice to make this happen by Turtle name, i.e.:

thing["rdf:type"]
thing["<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"]

both resolve to the same value. This means that RDFNode.prototype[Symbol.toPrimitive] should function like .toNT() and not .toString() (with .toString() behaviour reserved only for Literals which are actually strings).

(The reason for this being that without the </>, practically any string will return true for isIRI().)

RDF/JS Dataset support

Graph should support the methods of RDF/JS Dataset, or at the very least DatasetCore.
Al·rishāʼ should support the methods of RDF/JS DatasetFactory, or at the very least DatasetCoreFactory.

Always return a resource (the same one) when accessing an IRI of Graph

Instead of constantly revoking resources when they have zero entries, just allow resources to be empty, and create new ones on property access if none exists. So that one can go

graph = Al·rishāʼ.createGraph()
graph[`example:rsrc`][`example:p`] = `example value`

and have it work as expected. This should greatly simplify all code, and only has a cost for programs creating a large number of anonymous subjects and then deleting them all. A .prune() function on Al·rishāʼ.Graph to freeze and remove empty resources from the resource map might then be useful.

Optimize Graph.prototype.match() in the case that subject is given

It is not necessary to iterate over every triple when it is easy to get just the triples with a given subject. And likewise for triples with a given predicate, given a subject.

This will give graph.match(s, p, null) parity with graph[s][p] instead of being much slower.

RDFa Output

This should replace the .toDOMNode() API if possible.

Build out ResourceData infrastructure

This needs to be a separate class which can be extended (or, ideally, subclassed) with additional getters. The ideal situation would be to have a .data property on a Resource which automatically generates the right kind of ResourceData based on the properties of the node, but the infrastucture for this might be complex. Perhaps something like:

Al·rishāʼ.dataKinds.add(pname `example:type`, MyResourceData)
Al·rishāʼ.dataKinds.add(resource => resource.has(`example:p`), MyPResourceData)

These should return a Symbol which can then be used with Al·rishāʼ.dataKinds.remove() to remove the data kind.

The initial properties/methods should be something like:

  • resource
  • textDescription, createDescription(document)
  • textLabel, createLabel(document), toString(document)
  • textValue, createValue(document), valueOf(document)

The document in the above methods is for values which are rdf:XMLLiterals or rdf:HTML.

Hardcode nodes for RDF names

By which I mean those such as rdf:rest which are used often and currently being constructed every single time. Now that these are immutable there is no reason not to just use the same object for all of them.

RDFa Input

This is less of a priority than output, initially.

Add .removeMatches() to Resource

Since .matches() now follows Graph behaviour regarding null, a similar .removeMatches() function might be useful, e.g. to completely remove mention of a node from a graph.

JSON Output

This should produce the minimal JSON for both RDF Interfaces and RDF/JS applications to understand. This is NOT JSON‐LD output.

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.