I'm trying to load some basic json-ld content as a string, but I'm not able to see the namespace prefixes that should be included.
Given the following json-ld:
{
"@context": {
"name": "http://schema.org/name",
"image": {
"@id": "http://schema.org/image",
"@type": "@id"
},
"foaf": "http://xmlns.com/foaf/0.1/"
},
"name": "Manu Sporny",
"foaf:homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
I run this against the dotnetrdf library:
void Main()
{
var targetPath = @"C:\Users\me\MinContext.json";
var jsonStr = File.ReadAllText(targetPath);
var parser = new JsonLdParser();
var store = new TripleStore();
parser.Load(store, new StringReader(jsonStr));
var g = store.Graphs.FirstOrDefault();
IUriNode rdfType = g.CreateUriNode("rdf:type");
IUriNode home = g.CreateUriNode("foaf:homepage");
}
On the last line I get this RdfException message:
The Namespace URI for the given Prefix 'foaf' is not known by the in-scope NamespaceMapper. Did you forget to define a namespace for this prefix?
...and if you inspect the graph namespaces (g.NamespaceMap.Prefixes) you can see that it only contains three: rdf, rdfs and xsd.
So question: how do I get the foaf prefix and namespace to load correctly?
This is based on using NuGet package version 2.6.1