Code Monkey home page Code Monkey logo

jsonld-ex's People

Contributors

alexgleason avatar cheerfulstoic avatar kokakiwi avatar maennchen avatar marcelotto avatar rustra avatar talklittle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonld-ex's Issues

`Could not load remote context (http://schema.org/): %Jason.DecodeError`...

Hey!

I tried this with a few examples from articles I found online, but I was able to reproduce it with a simple example from the JSON-LD playground, so I'm going to provide that here. Here's what I tried:

"""
{
  "@context": "http://schema.org/",
  "@type": "Person",
  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}
"""
|> Jason.decode!()
|> JSON.LD.expand()

I notice that in this example the @context is a string, whereas from your README it's an object. Should I be doing some other operation? I'm pretty new to JSON+LD.... ๐Ÿ˜…

Fix expansion implementation to produce the expected order in the failing JSON-LD test suite tests

Affected tests:

  • Expansion
    • Test 0034 - Multiple properties expanding to the same IRI
    • Test 0035 - Language maps with @vocab, default language, and colliding property
    • Test 0038 - Expanding blank node labels
  • Flattening
    • Test 0034 - Multiple properties expanding to the same IRI
    • Test 0035 - Language maps with @vocab, default language, and colliding property
    • Test 0038 - Flattening blank node labels
  • Transform JSON-LD to RDF
    • Test 0118 - produce generalized RDF flag

InvalidLocalContextError when decoding an ActivityPub object

Hi, I'm getting this error when trying to decode a map:

iex(17)> JSON.LD.Decoder.to_rdf(data)
** (JSON.LD.InvalidLocalContextError) ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", %{"ChatMessage" => "litepub:ChatMessage", "Emoji" => "toot:Emoji", "EmojiReact" => "litepub:EmojiReact", "Hashtag" => "as:Hashtag", "PropertyValue" => "schema:PropertyValue", "alsoKnownAs" => %{"@id" => "as:alsoKnownAs", "@type" => "@id"}, "atomUri" => "ostatus:atomUri", "capabilities" => "litepub:capabilities", "conversation" => %{"@id" => "ostatus:conversation", "@type" => "@id"}, "directMessage" => "litepub:directMessage", "discoverable" => "toot:discoverable", "invisible" => "litepub:invisible", "listMessage" => %{"@id" => "litepub:listMessage", "@type" => "@id"}, "litepub" => "http://litepub.social/ns#", "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers", "oauthRegistrationEndpoint" => %{"@id" => "litepub:oauthRegistrationEndpoint", "@type" => "@id"}, "ostatus" => "http://ostatus.org#", "schema" => "http://schema.org#", "sensitive" => "as:sensitive", "toot" => "http://joinmastodon.org/ns#", "value" => "schema:value"}] is not a valid @context value
    (json_ld 0.3.3) lib/json/ld/context.ex:130: JSON.LD.Context.do_update/4
    (elixir 1.11.4) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
    (json_ld 0.3.3) lib/json/ld/expansion.ex:74: JSON.LD.Expansion.do_expand/4
    (json_ld 0.3.3) lib/json/ld/expansion.ex:21: JSON.LD.Expansion.expand/2
    (json_ld 0.3.3) lib/json/ld/decoder.ex:31: JSON.LD.Decoder.to_rdf/2

Wondering if you might know what could be causing it? This is the data:

%{
  "@context" => [
    "https://www.w3.org/ns/activitystreams",
    "https://dev.poast.org/schemas/litepub-0.1.jsonld",
    %{"@language" => "und"}
  ],
  "actor" => "https://dev.poast.org/users/alex",
  "attachment" => [],
  "attributedTo" => "https://dev.poast.org/users/alex",
  "bcc" => [],
  "bto" => [],
  "cc" => ["https://dev.poast.org/users/alex/followers"],
  "content" => "hello",
  "context" => "https://dev.poast.org/contexts/bbcb415f-72c3-415a-a62b-6b38a37f18fd",
  "id" => "https://dev.poast.org/objects/a80e4f4d-4fef-47d1-af77-5cf1b8e12f1a",
  "inReplyTo" => nil,
  "name" => nil,
  "published" => "2021-08-14T23:01:51.060514Z",
  "replies" => [],
  "replies_count" => 0,
  "sensitive" => false,
  "summary" => nil,
  "tag" => [
    %{
      "href" => "https://dev.poast.org/groups/hello-groups",
      "icon" => nil,
      "id" => nil,
      "name" => "@hello-groups",
      "type" => "Mention",
      "updated" => nil
    }
  ],
  "to" => ["https://dev.poast.org/groups/hello-groups",
   "https://www.w3.org/ns/activitystreams#Public"],
  "type" => "Note",
  "url" => nil
}

I'm playing around with this library in Pleroma, considering using it to validate JSON-LD signatures.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.