-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sample4_Frame.cs
41 lines (35 loc) · 1.09 KB
/
Sample4_Frame.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using Res = JsonLD.Demo.Resources.Resources;
using System;
using JsonLD.Core;
using Newtonsoft.Json.Linq;
namespace JsonLD.Demo
{
public class Sample4_Frame
{
private static readonly string _docJson = Res.ReadString("doc.json");
private static readonly string _frameJson = Res.ReadString("frame.json");
public static void Run()
{
var doc = JObject.Parse(_docJson);
var frame = JObject.Parse(_frameJson);
var opts = new JsonLdOptions();
var flattened = JsonLdProcessor.Frame(doc, frame, opts);
Console.WriteLine(flattened);
/*
Output:
{
"@context": . . .,
"@graph": [
{
"@id": "_:b0",
"@type": "Person",
"image": "http://manu.sporny.org/images/manu.png",
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/"
}
]
}
*/
}
}
}