Skip to content

Conversation

@JordanShurmer
Copy link

This is for #2. See the issue for more discussion.

Copy link
Contributor

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this. However, this PR reduces the compatibility of solid-namespace from all RDF/JS-compatible libraries to just rdflib.js. This does not seem an enhancement to me, hence my non-approval.

README.md Outdated

A collection of common RDF namespaces used in the Solid project.

solid-namespace is meant to be used with [rdflib.js](/linkeddata/rdflib.js). It exports a collection of `NamedNode` values for commonly used namespaces, thereby shortcutting the need to call `$rdf.namespace(...)`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to be used with any RDF/JS-compatible library, including rdflib.js.

package.json Outdated
"rdf": "^4.0.1"
},
"devDependencies": {
"standard": "^12.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope for this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true. removing.

This returns things similar to how they were functioning in 0.1.0
but keeps all the additional namespaces and reduces the dependencies
@JordanShurmer
Copy link
Author

@RubenVerborgh I've reworked my fork to work as described above and updated the README and JS doc comments etc.

Let me know what you think!

Copy link
Contributor

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one step, but 'Namespace is not in RDF/JS.

What we really need is the following:

  • if no RDF library provided, return concatenated string
  • if RDF library provided, return NamedNode

So, given your const aliases (renamed to prefixes), we need (draft and untested):

return function (rdf = { namedNode: u => u }) {
  const namespaces = {};
  for (const prefix in prefixes) {
    const expansion = prefixes[prefix];
    namespaces[prefix] = function (localName = '') {
      return rdf.namedNode(expansion + localName);
    };
  };
  return namespaces;
};

More elaborate version at https://github.com/rdfjs/N3.js/blob/v1.0.0-beta.2/lib/N3Util.js#L42

@JordanShurmer
Copy link
Author

Interesting.. didn't realize that Namespace wasn't part of RDF/JS! $rdf.Namespace is what the inrupt/solid guides have you use, so I assumed that was the standard thing, and that namedNode was the rdflib.js specific thing. Got it directly backwards 🤦‍♂️

I totally botched the exporting of an object when no rdflib is given too.

I'll get this eventually! 😑

@RubenVerborgh
Copy link
Contributor

$rdf.Namespace is what the inrupt/solid guides have you use

They might be a bit foo focused on rdflib (from my perspective, opinions vary).

I'll get this eventually! 😑

Hey, thanks for persisting :-) The result is going to be something better than either of us would've done alone.

@JordanShurmer
Copy link
Author

The result is going to be something better than either of us would've done alone.

Definitely!

Have a look now.. I also added tests to avoid my botching something obvious again :D

Copy link
Contributor

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it, thanks for the tests as well. Minor nit: I think we're following standard here, so no semis (but I realized I introduced them).

@JordanShurmer
Copy link
Author

So how do we get this PR actually merged? Am I supposed to do something at this point?

@RubenVerborgh
Copy link
Contributor

I don't have publish permissions on solid-namepaces, so I can merge but not publish.

Next time, could you please not bump the version? Because package maintainers usually have their own process for doing that.

@RubenVerborgh RubenVerborgh merged commit 0900cfc into solid:master Oct 29, 2018
@JordanShurmer
Copy link
Author

Next time, could you please not bump the version? Because package maintainers usually have their own process for doing that.

👍 understood, that makes total sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants