Skip to content

Improve README and start to decouple JSON #74

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,16 @@ Refract is a recursive data structure for expressing complex structures, relatio

Refract is a structure for handling all sorts and kinds of data across all sorts and kinds of formats. That's a very general-purpose description for a general-purpose structure. To get an idea of what Refract does, we'll walk through some of its uses with some examples along the way.

### As a way to annotate JSON
### As a way to annotate data

Refract provides the ability to take a normal JSON structure and add a layer on top of it for the puprose of annotating and adding semantic data. Refract is not the first structure to try and tackle this task, though it does take a different approach. Instead of creating an entirely different structure to describe the data, Refract's approach is to expand the existing structure (we call it "refracting" a structure). Here is an example to show our point.
Refract provides the ability to take data structures and add a layer on top of it for the purpose of annotating and adding semantic data. Refract is not the first structure to try and tackle this task, though it does take a different approach. Instead of creating an entirely different structure to describe the data, Refract's approach is to expand the existing structure (we call it "refracting" a structure). Here is an example to show our point.

Take the following simple JSON object.
Take the following simple object which contains a name and email.

```json
{
"name": "John Doe",
"email": "[email protected]"
}
```
- name: John Doe
- email: [email protected]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would make sense to keep this as JSON for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think you're right. You could make the distinction that it's a JSON example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may even link to the JSON serializarion rules.


Using Refract, we can expand this out and add some human-readable titles and descriptions.
Using Refract, we can expand this out and add some human-readable titles and descriptions. As JSON that may look as follows:

```json
{
Expand All @@ -51,8 +47,14 @@ Using Refract, we can expand this out and add some human-readable titles and des
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I think JSON may be the best way to express this structure as it is very detailed and contains a lot of information. I've left it in JSON, especially since the future paragraphs talk about "JSON" in comparison to this structure.

I have updated the serialisation of the meta components to follow JSON serialisation rules.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

"element": "member",
"meta": {
"title": "Name",
"description": "Name of a person"
"title": {
"element": "string",
"content": "Name"
},
"description": {
"element": "string",
"content": "Name of a person"
}
},
"content": {
"key": {
Expand All @@ -68,8 +70,14 @@ Using Refract, we can expand this out and add some human-readable titles and des
{
"element": "member",
"meta": {
"title": "Email",
"description": "Email address for the person"
"title": {
"element": "string",
"content": "Email",
},
"description": {
"element": "string",
"content": "Email address for the person"
}
},
"content": {
"key": {
Expand All @@ -88,7 +96,7 @@ Using Refract, we can expand this out and add some human-readable titles and des

We added some semantic data to the existing data, but we did so while retaining the semantic structure of the data with the `object` and `string` elements. **This means there is no semantic difference in the Refract structure and the original JSON structure**. It also means we can add extra semantics on top of these structural ones.

Just some notes on Refract, the `meta` section shown here is reserved for Refract-specific properties for each element. These properties provide ways to address and link to data, add human-readable data as such, and even include namespaces of defined elements.
Just some notes on Refract, the `meta` section shown here is reserved for Refract-specific properties for each element. These properties provide ways to address and link to data, add human-readable data as such, and even include profile of defined elements.

### As a unifying structure

Expand Down Expand Up @@ -136,3 +144,4 @@ Lastly, Refract is meant to provide a model for client libraries. As mentioned,
- [Mark Foster](https://github.com/fosrias)
- [Zdenek Nemec](https://github.com/zdne)
- [Daniel G. Taylor](https://github.com/danielgtaylor)
- [Kyle Fuller](https://fuller.li)