Closed sgillies closed 8 years ago
I may have a separate problem in my example. See https://github.com/geojson/geojson-ld/issues/38#issuecomment-152583752.
@neothemachine thanks!
The parser complains because there is a comma too much in the context document. JSON doesn't allow superfluous commas.
@neothemachine but even when that's fixed, I get
{
"name": "jsonld.CompactError",
"message": "Could not expand input before compaction.",
"details": {
"cause": {
"name": "jsonld.SyntaxError",
"message": "Invalid JSON-LD syntax; colliding keywords detected.",
"details": {
"code": "colliding keywords",
"keyword": "@type"
}
}
}
}
Ah, you're right, I didn't try to use type and @type both together. Interesting, I also thought that worked in the past.
I am not sure what is the issue here. The following example works for me well:
{
"@context": {
"geojson": "http://ld.geojson.org/vocab#",
"Feature": "geojson:Feature",
"FeatureCollection": "geojson:FeatureCollection",
"GeometryCollection": "geojson:GeometryCollection",
"LineString": "geojson:LineString",
"MultiLineString": "geojson:MultiLineString",
"MultiPoint": "geojson:MultiPoint",
"MultiPolygon": "geojson:MultiPolygon",
"Point": "geojson:Point",
"Polygon": "geojson:Polygon",
"bbox": {
"@container": "@list",
"@id": "geojson:bbox"
},
"coordinates": "geojson:coordinates",
"description": "http://purl.org/dc/terms/description",
"features": {
"@container": "@set",
"@id": "geojson:features"
},
"geometry": "geojson:geometry",
"id": "@id",
"properties": "geojson:properties",
"title": "http://purl.org/dc/terms/title",
"type": "@type"
},
"type": "FeatureCollection",
"id": "http://example.com/collections/1",
"features": [
{
"type": ["Feature", "Place"],
"id": "http://example.com/collections/1/features/1",
"properties": {"name": "Fort Collins, Colorado" },
"geometry": {"type": "Point", "coordinates": [-105.078056, 40.559167]}
},
{
"type": ["Feature", "Place"],
"id": "http://example.com/collections/1/features/2",
"properties": {"name": "Boulder, Colorado" },
"geometry": {"type": "Point", "coordinates": [-105.251945, 40.027435]}
}
]
}
I combined the example from README with the context linked above.
The issue is of course that you cannot use both id
and @id
at the same time. But I think this is a reasonable restriction?
@mitar This is not valid GeoJSON anymore as "type" must be a string.
Then make it only one of those types? Whatever is reasonable for GeoJSON use?
I've found a huge problem with the GeoJSON-LD contexts in this repo.
The aliasing of
@id
toid
at https://github.com/geojson/geojson-ld/blob/master/contexts/geojson-base.jsonld and the aliasing of@type
totype
at https://github.com/geojson/geojson-ld/blob/master/contexts/geojson-base.jsonld#L27 breaks the http://json-ld.org/playground/ parser.It says at http://www.w3.org/TR/json-ld/#aliasing-keywords
My interpretation was that "@id" was the keyword, not "id", but it seems I'm wrong. I remember running the contexts through the JSON-LD playground in the past without trouble, but that could be a bogus memory.
The consequence: ordinary GeoJSON can not be converted to JSON-LD merely by attaching one of this project's context docs. You'd actually need to edit the GeoJSON doc itself. A lot of my ambitions for this GeoJSON-LD project are going up in smoke.
Anybody else have a different take?