Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of a dependency to hold the defined route context/base template info #31

Open
fincamd opened this issue Mar 24, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@fincamd
Copy link

fincamd commented Mar 24, 2020

One thing came to my mind after reading @luispc1998 proposal on #22.

I have realised (as many of you surely) that such proposal's route files written in JSON-LD have to include the "@context" key with a specific value.

As it is something that is constant to all files following such pattern, I came with the idea of centralising that "@context" object into some sort of package/class/object/function thing, defining it as a dependency (say on npm for instance) associated with this repo/standard definition and using it from the apps that need it.

The reason for this is to avoid hardcoding such potentially living thing as this document is. This
would mean that whenever this standard evolves, so does the files produced by the applications using this resource. The only thing needed would be to update the dependency.

Although I don't have a clue on how this can be done yet, I will try to conduct a little research on the matter see if I can find something.

@fincamd fincamd added the enhancement New feature or request label Mar 24, 2020
@fincamd fincamd self-assigned this Mar 24, 2020
@fincamd
Copy link
Author

fincamd commented Mar 24, 2020

I think this idea could be extended to the full base template for a route file inlcuding name, description, points, etc.

@labra
Copy link
Contributor

labra commented Mar 24, 2020

Do you mean creating a dereferentiabe context file in this project?

It seems ok for me, could you create a draft proposal in a Pull request?

@fincamd
Copy link
Author

fincamd commented Mar 30, 2020

I have been thinking about this for a little now and this is what I ment at the very beginning:

{
	"@context": {
		"@version": 1.1,
		"comments": {
			"@container": "@list",
			"@id": "viade:comments"
		},
		"description": {
			"@id": "schema:description",
			"@type": "xs:string"
		},
		"media": {
			"@container": "@list",
			"@id": "viade:media"
		},
		"name": {
			"@id": "schema:name",
			"@type": "xs:string"
		},
		"points": {
			"@container": "@list",
			"@id": "viade:points"
		},
		"latitude": {
			"@id": "schema:latitude",
			"@type": "xs:double"
		},
		"longitude": {
			"@id": "schema:longitude",
			"@type": "xs:double"
		},
		"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
		"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
		"schema": "http://schema.org/",
		"viade": "http://arquisoft.github.io/viadeSpec/",
		"xsd": "http://www.w3.org/2001/XMLSchema#"
	},
	"comments": [],
	"media": [],
	"name": ,
	"description": ,
	"points":
}

This file would be uploaded inside the repo for the applications to fetch with an URI. Then it would be parsed into memory and the generated object could be updated with data obtained from our applications. Then this object is serialized again using JSON.stringify(...) function to be saved to a json file. From here it can be uploaded to the POD or saved in the user's computer. Here is a sample of its usage:

modifyFromJsonLd(stringData) {
	let parsedRoute = JSON.parse(stringData);
	parsedRoute["name"] = this.name;
	parsedRoute["description"] = this.description;
	parsedRoute["points"] = processPoints(this.points);
        return JSON.stringify(parsedRoute);
}

Where parameter stringData is the data read from the file.

Please, should there be anything unclear, let me know so I can provide further examples.

@fincamd
Copy link
Author

fincamd commented Mar 30, 2020

It is taken for granted that if some other piece of information is needed, it can be appended to the object with a simple dictionary key access while leaving the standard route template untouched.

parsedRoute["extraInfo"] = this.extraInfo;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants