File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ function Get-JsonLD {
9
9
. EXAMPLE
10
10
# Want to get information about a movie? Linked Data to the rescue!
11
11
Get-JsonLD -Url https://www.imdb.com/title/tt0211915/
12
+ . EXAMPLE
13
+ # Want information about an article? Lots of news sites use this format.
14
+ Get-JsonLD https://www.thebulwark.com/p/mahmoud-khalil-immigration-detention-first-amendment-free-speech-rights
12
15
#>
13
16
[Alias (' jsonLD' , ' json-ld' )]
14
17
param (
@@ -41,13 +44,20 @@ application/ld\+json # The type that indicates linked d
41
44
$match.Groups [' JsonContent' ].Value |
42
45
ConvertFrom-Json
43
46
) {
44
- if ($jsonObject .' @context ' -and $jsonObject . ' @ type' ) {
47
+ if ($jsonObject .' @type' ) {
45
48
$schemaType = $jsonObject .' @context' , $jsonObject .' @type' -join ' /'
46
- $jsonObject.pstypenames.insert (0 , $schemaType )
49
+ $jsonObject.pstypenames.insert (0 , $schemaType )
50
+ }
51
+
52
+ if ($jsonObject .' @graph' ) {
53
+ foreach ($graphObject in $jsonObject .' @graph' ) {
54
+ if ($graphObject .' @type' ) {
55
+ $graphObject.pstypenames.insert (0 , $graphObject .' @type' )
56
+ }
57
+ }
47
58
}
48
59
$jsonObject
49
60
}
50
- }
51
-
61
+ }
52
62
}
53
63
}
You can’t perform that action at this time.
0 commit comments