Closed James-Hudson3010 closed 4 years ago
I have the following json-ld file:
{ "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "xsd": "http://www.w3.org/2001/XMLSchema#", "hr": "http://learningsparql.com/ns/humanResources#", "d": "http://learningsparql.com/ns/data#", "sh": "http://www.w3.org/ns/shacl#", "sch": "http://schema.org/" }, "@graph": [ { "@id": "hr:Employee", "@type": "rdfs:Class", "rdfs:comment": "a good employee", "rdfs:label": "model" }, { "@id": "hr:Another", "@type": "rdfs:Class" }, { "@id": "hr:name", "@type": "rdf:Property", "sch:domainIncludes": [ { "@id": "hr:Employee" } ] }, { "@id": "hr:freestanding", "@type": "rdf:Property", "sch:rangeIncludes": [ { "@id": "sch:Text" } ] }, { "@id": "hr:nosuper", "@type": "rdf:Property", "sch:rangeIncludes": [ { "@id": "sch:Text" } ], "sch:domainIncludes": [ { "@id": "hr:Uncreated" } ] }, { "@id": "hr:randomtype", "@type": "hr:invalidtype", "rdfs:comment": "some comment about randomtype", "rdfs:label": "some label about randomtype" }, { "@id": "hr:typo", "@type": "rdfs:Classs", "rdfs:comment": "some comment about typo", "rdfs:label": "some label about typo" }, { "@id": "hr:missing", "rdfs:comment": "some comment about missing" } ] }
If I use json-ld 0.4.0 (the last released version) with the following code:
import toml import json import os import glob import rdflib from pprint import pprint PATH = "/Users/jamesh/depot/sparql_work/data_graph.jsonld" datagraph = open( PATH, "r" ).read() g = rdflib.Graph().parse( data = datagraph, format = 'json-ld' ) print( g.serialize( format = 'ttl' ).decode( 'utf8' ) )
the what is printed is:
@prefix d: <http://learningsparql.com/ns/data#> . @prefix hr: <http://learningsparql.com/ns/humanResources#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sch: <http://schema.org/> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
However, if I clone the project and pip install from the master branch (0.5.0.dev0), I get the expected result:
@prefix d: <http://learningsparql.com/ns/data#> . @prefix hr: <http://learningsparql.com/ns/humanResources#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sch: <http://schema.org/> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . hr:Another a rdfs:Class . hr:Employee a rdfs:Class ; rdfs:label "model" ; rdfs:comment "a good employee" . hr:freestanding a rdf:Property ; sch:rangeIncludes sch:Text . hr:missing rdfs:comment "some comment about missing" . hr:name a rdf:Property ; sch:domainIncludes hr:Employee . hr:nosuper a rdf:Property ; sch:domainIncludes hr:Uncreated ; sch:rangeIncludes sch:Text . hr:randomtype a hr:invalidtype ; rdfs:label "some label about randomtype" ; rdfs:comment "some comment about randomtype" . hr:typo a rdfs:Classs ; rdfs:label "some label about typo" ; rdfs:comment "some comment about typo" .
Needless to say, I am eager for another release as soon as possible.
I just released rdflib-jsonld 0.5.0 from current master. I hope this makes things better!
Awesome. Thank you.
I have the following json-ld file:
If I use json-ld 0.4.0 (the last released version) with the following code:
the what is printed is:
However, if I clone the project and pip install from the master branch (0.5.0.dev0), I get the expected result:
Needless to say, I am eager for another release as soon as possible.