GithubHelp home page GithubHelp logo

Comments (7)

edmondchuc avatar edmondchuc commented on June 20, 2024 1

As far as i understand it should be "@type": "http://xmlns.com/foaf/0.1/Person" instead, without the [...]

I guess the serialized result you got there is just the JSON-LD in the expanded form. If you don't want it as a list, you can use compaction. Behaviour of @type here is relevant? https://www.w3.org/TR/json-ld11/#using-set-with-type.

Sorry, haven't looked too much into how this is related to your original issue though.

from rdflib.

WhiteGobo avatar WhiteGobo commented on June 20, 2024

It fails at this point: (rt is the dict {"@value": "another thing"})

typeterm = self.terms.get(rt)

This is the testfile that fails to be loaded again:

# Test the syntactic items for abbreviation.
# This is *not* testing rule application.
@prefix : <#> .
_:a => _:b .
_:a <= _:b .
_:a = _:b .
# 'this' refers to the current formula so is not legal for RDF
# this a "thing".
<> a "thing too".
<#> a "another thing".

from rdflib.

WhiteGobo avatar WhiteGobo commented on June 20, 2024

Ok i'm pretty sure this is a bug in the serializer and not in the parser. @type should be a term, a compact iri or a reference and shouldnt contain value objects.(edited after comment from edmondchuc)

I would change the parser to give more leniency and let it fallback to its behaviour of version 1.0, till the bug in the serializer is repaired. We could remove this behaviour or at least raise a warning in the next major release of rdflib.

from rdflib.

WhiteGobo avatar WhiteGobo commented on June 20, 2024
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
[] a foaf:Person.

is serialized to

[
  {
    "@id": "_:ncd6c76112bd148c0a0c9a8a035854d6cb1",
    "@type": [
      "http://xmlns.com/foaf/0.1/Person"
    ]
  }
]

As far as i understand it should be "@type": "http://xmlns.com/foaf/0.1/Person" instead, without the [...]

from rdflib.

WhiteGobo avatar WhiteGobo commented on June 20, 2024

Mh your right. I still think value objects arent allowed in that array. so things like {"@type": [{"@value": "thing too"}]} shouldnt be allowed. (ive changed my comment above to reflect this)

from rdflib.

edmondchuc avatar edmondchuc commented on June 20, 2024

Yeah, probably the JSON-LD processor in RDFLib is just not as strict. Your provided example fails in https://json-ld.org/playground/ when the value of @type is a value object.

JSON-LD example: https://tinyurl.com/2atu5gdy

from rdflib.

WhiteGobo avatar WhiteGobo commented on June 20, 2024

Ive renamed the issue, because of the bug in the serializer. Now Roundtrip test with default jsonld version 1.1 will succeed.

from rdflib.

Related Issues (20)

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.