Comments (7)
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.
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.
@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.
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.
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.
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.
http://json-ld.org/spec/ED/json-ld-syntax/20120122/#iri-expansion-within-a-context
from json-ld.org.
Related Issues (20)
- Framing primitive types vs typed literals HOT 1
- create a repo for NDJSON-LD HOT 2
- create a repo for NDJSON-LD [1] HOT 1
- Playground is choking on `http://schema.org` (no trailing slash) HOT 4
- Json ld
- Change redirect for RDF Dataset Canonicalization to WG spec
- json-ld.org site is down HOT 2
- playground error: read properties of null HOT 2
- Proposal: Using `@graph` to specify the name of the graph which contains a statement
- JSON-LD for R? HOT 2
- @base treats trailing hash ('#') different from slash '/' HOT 3
- Improve playground proxy and/or playground document loader HOT 3
- Output N-Quads in the Playground
- proposal for @shift keyword HOT 7
- Issue compacting using a context with a property value index HOT 2
- Creating a gist fails HOT 4
- JSON-LD Context similarity to XML External Entity attack HOT 1
- Recursive index map of index maps HOT 4
- How to combine two or more script into one using json-ld
- type-scoped local context is not applied if the @type property is @nested HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-ld.org.