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

Support reserved character "@" to be used in predicate naming #4897

Open
MichelDiz opened this issue Mar 7, 2020 · 1 comment
Open

Support reserved character "@" to be used in predicate naming #4897

MichelDiz opened this issue Mar 7, 2020 · 1 comment

Comments

@MichelDiz
Copy link
Member

@MichelDiz MichelDiz commented Mar 7, 2020

Experience Report

What you wanted to do

Have the possibility to insert JSON-LD directly into Dgraph instead of having to convert the entire dataset manually.

What you actually did

I tried to run a JSON-LD with JSON mutation.

{
   "set": [
      {
         "@context": "http://schema.org/",
         "@type": "Movie",
         "name": "Avatar",
         "Director": {
            "@type": "Person",
            "name": "James Cameron",
            "birthDate": "1954-08-16"
         },
         "genre": "Science fiction",
         "trailer": "../movies/avatar-theatrical-trailer.html"
      }
   ]
}

Why that wasn't great, with examples

The "@" character is a character reserved for language support. However, it is a character that is used between two words and not at the beginning of a word. Therefore, it makes no sense to reserve it that way.

Releasing this character would have a "kind of JSON-LD support".

This would be a good step to allow different RDF based datasets to be loaded into Dgraph.

Any external references to support your case

Code reference

return errors.Errorf("Attr: [%v] should have @lang directive in schema to mutate edge: [%v]",

User comment about JSON-LD
#1 (comment)

Also check
#616

Tests I made with other characters

Can not be mutate

_: b0 <@context> "test".
_: b0 <\ context> "test".
_: b0 <\ context> "test".
_: b0 <~ context> "test".
_: b0 <^ context> "test".
_: b0 <`context>" test ".
_: b0 <{context> "test".
_: b0 <} context> "test".

Can

_: b0 <´context> "test".
_: b0 <[context> "test".
_: b0 <] context> "test".
_: b0 <'context> "test".

Captura de Tela 2020-03-07 às 18 33 12

Other JSON-LD examples:

{
  "@context": "http://schema.org/",
  "@type": "Person",
  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}
{
  "@context": {
    "ical": "http://www.w3.org/2002/12/cal/ical#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "ical:dtstart": {
      "@type": "xsd:dateTime"
    }
  },
  "ical:summary": "Lady Gaga Concert",
  "ical:location": "New Orleans Arena, New Orleans, Louisiana, USA",
  "ical:dtstart": "2011-04-09T20:00:00Z"
}
{
  "@context": {
    "name": "http://schema.org/name",
    "description": "http://schema.org/description",
    "image": {
      "@id": "http://schema.org/image",
      "@type": "@id"
    },
    "geo": "http://schema.org/geo",
    "latitude": {
      "@id": "http://schema.org/latitude",
      "@type": "xsd:float"
    },
    "longitude": {
      "@id": "http://schema.org/longitude",
      "@type": "xsd:float"
    },
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "name": "The Empire State Building",
  "description": "The Empire State Building is a 102-story landmark in New York City.",
  "image": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg",
  "geo": {
    "latitude": "40.75",
    "longitude": "73.98"
  }
}
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "@type": "Create",
  "actor": {
    "@type": "Person",
    "@id": "acct:sally@example.org",
    "name": "Sally"
  },
  "object": {
    "@type": "Note",
    "content": "This is a simple note"
  },
  "published": "2015-01-25T12:34:56Z"
}
@MichelDiz

This comment has been minimized.

Copy link
Member Author

@MichelDiz MichelDiz commented Mar 11, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.