Coder Social home page Coder Social logo

Resolving url paths about rdf-ext HOT 18 CLOSED

rdf-ext avatar rdf-ext commented on June 4, 2024
Resolving url paths

from rdf-ext.

Comments (18)

ktk avatar ktk commented on June 4, 2024

Hi Nicola,

Thanks for the feedback, credits go mainly to @bergos :)

I don't think path resolving is currently implemented, question is is this defined behavior in RDF? And this question could probably be answered by @retog

from rdf-ext.

bergos avatar bergos commented on June 4, 2024

How did you parse the graph? For example the JSON-LD parser would resolve the relative path in the expand step. But like @ktk mentioned, first we need to know if there is a definition? Maybe @RubenVerborgh has an answer to this question.

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

The conclusive answer is in the RDF 1.1 specification:

Relative IRIs must be resolved against a base IRI to make them absolute.

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

And the fact that this doesn't happen seems to be an N3.js bug: rdfjs/N3.js#51

from rdf-ext.

bergos avatar bergos commented on June 4, 2024

@nicola btw. have you seen Clownface for graph traversing? Here an example how you would fetch the preferences file:

var cf = rdf.cf.Store(new rdf.promise.Store(new rdf.LdpStore()));

cf.node('https://nicola.databox.me/profile/card#me')
  .then(function (cf) {
    console.log(cf.out('http://www.w3.org/ns/pim/space#preferencesFile').literal().shift());
  });

from rdf-ext.

nicola avatar nicola commented on June 4, 2024

Of course I have seen it, it is very cool (I think that should be decoupled from this library as well!!).
I was going to build a similar system and I found it - I will let you know what I think after using it for a bit

from rdf-ext.

retog avatar retog commented on June 4, 2024

@RubenVerborgh it doesn't exactly not happen, the IRI Ref is not kept relative which would be against the specs (except the LDP spec, but that's another story). The thing is that the IRI is not made absolute the right way (i.e. according to the IRI RFC 3987 and RFC 3986): instead of https://nicola.databox.me/profile/../Preferences/prefs it should be https://nicola.databox.me/Preferences/prefs.

from rdf-ext.

nicola avatar nicola commented on June 4, 2024

I hope that is the case, or it would be a nightmare for me to do that simple operation

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

@retog Yes, that's what I mean: the resolving happens by just sticking both parts together, whereas (only) leading sequences of ../ in the relative URL should be correctly removed when resolving. It's a bug in N3.js, which I will fix soon.

from rdf-ext.

nicola avatar nicola commented on June 4, 2024

I just got a funny: https://nicola.databox.me/profile/../Preferences/../

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

Fixed in rdfjs/N3.js@1a0dc71 without performance impact on other types of IRIs. Will leave people some time to verify the correctness of the solution and then do a 0.4.4 release that includes the fix.

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

@retog I actually found the RDF spec to be ambiguous about IRI resolution: https://lists.w3.org/Archives/Public/public-rdf-comments/2015Aug/0000.html. Until an answer is found, I don't feel comfortable landing a release.

from rdf-ext.

ktk avatar ktk commented on June 4, 2024

@RubenVerborgh if I get that correctly the discussion is pretty much set right? Any ETA for new release?

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

Not set, no, still actively discussing: https://lists.w3.org/Archives/Public/public-rdf-comments/2015Sep/
ETA: could still be a week.

from rdf-ext.

ktk avatar ktk commented on June 4, 2024

Ah didn't notice that I only saw postings in August in the web interface of the list, thanks for the link.

from rdf-ext.

retog avatar retog commented on June 4, 2024

@RubenVerborgh iiuc the spec ambiguity only applies when the Turtle document contains non-normalized non-relative IRIs (i.e. the document contains https://nicola.databox.me/profile/../Preferences/prefs as base IRI or as a IRI for a resource). I seems however clear that when a relative IRI with trailing [./|../]* and no other ./ or ../ has to be resolved against a normal based IRI this has to result in a normal resource IRI. So in the example in this issue the resource name should be https://nicola.databox.me/Preferences/prefs rather than https://nicola.databox.me/profile/../Preferences/prefs under any plausible interpretation of the spec.

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

@retog Yes indeed, there's no unclarity about this specific case; consequently, the fix for this case was already made 2 weeks ago. However, I'm still waiting for a confirmation for other cases, so the next release of N3.js does IRI resolution correct in all cases, not just this one.

from rdf-ext.

RubenVerborgh avatar RubenVerborgh commented on June 4, 2024

Released N3.js 0.4.4 with correct implementation of RFC 3986, which includes the cases in this thread.

from rdf-ext.

Related Issues (20)

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.