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

Closed
MichelDiz opened this issue Mar 7, 2020 · 3 comments
Closed

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

MichelDiz opened this issue Mar 7, 2020 · 3 comments
Labels
area/mutations Related to mutations JSON or RDF. area/parsing Issues related to the parser or lexer. dgraph Issue or PR created by an internal Dgraph contributor. kind/bug Something is broken. priority/P3 Low priority, something to be done once everything else seems fixed. Stale status/accepted We accept to investigate/work on it.

Comments

@MichelDiz
Copy link
Contributor

MichelDiz commented Mar 7, 2020

Experience Report

reference: https://discuss.dgraph.io/t/support-json-ld-on-dgraph/7162

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
https://github.com/dgraph-io/dgraph/blob/2a091db1608e4d3035f5f51546e67f5ff6c0b13b/worker/mutation.go#L356

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 MichelDiz added area/parsing Issues related to the parser or lexer. area/mutations Related to mutations JSON or RDF. kind/bug Something is broken. labels Mar 7, 2020
@MichelDiz
Copy link
Contributor Author

JSON-LD keywords reverence:
https://www.w3.org/TR/json-ld11/#syntax-tokens-and-keywords

@mangalaman93 mangalaman93 added the status/accepted We accept to investigate/work on it. label Mar 27, 2020
@minhaj-shakeel
Copy link
Contributor

Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing

@MichelDiz MichelDiz reopened this Jul 30, 2022
@MichelDiz MichelDiz added the dgraph Issue or PR created by an internal Dgraph contributor. label Oct 25, 2022
@rderbier rderbier added the priority/P3 Low priority, something to be done once everything else seems fixed. label Jan 10, 2023
Copy link

github-actions bot commented Aug 5, 2024

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

@github-actions github-actions bot added the Stale label Aug 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mutations Related to mutations JSON or RDF. area/parsing Issues related to the parser or lexer. dgraph Issue or PR created by an internal Dgraph contributor. kind/bug Something is broken. priority/P3 Low priority, something to be done once everything else seems fixed. Stale status/accepted We accept to investigate/work on it.
Development

No branches or pull requests

4 participants