GithubHelp home page GithubHelp logo

Comments (7)

gkellogg avatar gkellogg commented on July 22, 2024

The problem comes to play when an author wants to create a context both defining terms and using them in @datatype. For example:

@context: {
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "date": {"@iri": "http://purl.org/dc/terms/date", "@datatype": "xsd:date"}
}

This requires two passes over @context, first to resolve prefixes, and second to use those prefixes in @datatype declarations. Note that before, when @Coerce was a separate object, this processing was in effect; it was lost when we folded in datatypes with prefix definitions.

As a related issue, we could consdier the following:

@context: {
  "xsd": "http://www.w3.org/2001/XMLSchema#",
  "dc": "http://purl.org/dc/terms/",
  "date": {"@iri": "dc:date", "@datatype": "xsd:date"}
}

This adds another layer of complication, as it may require more than two passes to resolve the use of CURIEs in @iri definitions, so I would not go this far, although the use of a CURIE should be allowed, if it is defined in an outer context.

I believe that we should adopt the first form, as it is a natural way to create a context for authors, and there is a reasonable possibility that there will be errors if authors do not separate prefix definitions from the usage in datatypes.

I propose that we formally say that context object traversal is a two-pass operation, where first IRIs for defined terms are identified and then @datatype and @list processing occurs, so that prefixes defined within a context can be used for @datatype definitions.

As an alternative, we could define a set of terms that are defined in a global "default" context, similar to RDFa's default context. There we could define mappings for xsd, rdf, dc, foaf, schema and others. This would eliminate most need for doing two-pass processing of contexts.

from json-ld.org.

lanthaler avatar lanthaler commented on July 22, 2024

Demo in PHP supporting CURIEs in @iri and @datatype: https://github.com/lanthaler/JSON-LD-experiments/blob/master/context-coerce-merge.php

-----Original Message-----
From: Gregg Kellogg [mailto:reply+i-2273041-
[email protected]]
Sent: Friday, November 18, 2011 4:00 AM
To: Markus Lanthaler
Subject: [json-ld.org] IRI expansion within @context requires terms to
be previously defined (#41)

The spec describes defining an @context in terms of having an "active
context". This allows terms and prefixes to be used within a @context
definition, if they are defined earlier.

Update the spec to ensure that this is clear, and to allow both from
contexts defined in a higher object, and those that precede within an
array of contexts.


Reply to this email directly or view it on GitHub:
#41

from json-ld.org.

lanthaler avatar lanthaler commented on July 22, 2024

@gkellogg, what about using prefixes defined in the local context in @iri? Is that allowed or not? In my opinion it would make sense to allow that as well.

from json-ld.org.

gkellogg avatar gkellogg commented on July 22, 2024

That creates some circularity, as you may need to process n-1 times to resolve everything. It was easier to just require full IRis. If you can think of reasonable language in Context handling, we could consider this.

from json-ld.org.

lanthaler avatar lanthaler commented on July 22, 2024

OK, I will try to come up with something. I'm not sure though if I'll be able to do that before Christmas..

-----Original Message-----
From: Gregg Kellogg [mailto:reply+i-2273041-
[email protected]]
Sent: Thursday, December 15, 2011 10:38 PM
To: Markus Lanthaler
Subject: Re: [json-ld.org] IRI expansion within @context requires terms
to be previously defined (#41)

That creates some circularity, as you may need to process n-1 times to
resolve everything. It was easier to just require full IRis. If you can
think of reasonable language in Context handling, we could consider
this.


Reply to this email directly or view it on GitHub:
#41 (comment)

from json-ld.org.

lanthaler avatar lanthaler commented on July 22, 2024

RESOLVED: IRI expansion should work in @context for prefixes and terms used on the right-hand side of prefix/term declarations, including @type and @id. The IRI expansion algorithm SHOULD be recursive, in that it continues to execute as long as one prefix/term is expanded in the current cycle. If a cycle is detected during resolution, then an exception MUST be thrown.

from json-ld.org.

msporny avatar msporny commented on July 22, 2024

http://json-ld.org/spec/ED/json-ld-syntax/20120122/#iri-expansion-within-a-context

from json-ld.org.

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.