KeyError: 'http://schema.org/item'
Opened this issue · 0 comments
tisdall commented
The exception goes away if I either remove the @id
or the url
in the ListItem
. I'm new to this so maybe the format is wrong, but it seems like pyld should raise a JsonLdError
if that were the case and not a KeyError
.
I'm running pyld 1.0.5 on Python 2.7.15 .
from pyld import jsonld
x = jsonld.frame(
{
"@context": "http://schema.org",
"@graph": [
{
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"item": {
"@id": "https://example.com/",
"@type": "WebPage",
"url": "https://example.com/"
}
}
]
}
]
},
{}
)
Output:
Traceback (most recent call last):
File "<console>", line 15, in <module>
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 201, in frame
return JsonLdProcessor().frame(input_, frame, options)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 982, in frame
framed = self._frame(expanded, expanded_frame, options)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 2545, in _frame
state, sorted(state['subjects'].keys()), frame, framed, None)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 3516, in _match_frame
state, [o['@id']], subframe, output, prop)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 3516, in _match_frame
state, [o['@id']], subframe, output, prop)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 3434, in _match_frame
self._remove_embed(state, id_)
File "/usr/local/lib/python2.7/site-packages/pyld/jsonld.py", line 3784, in _remove_embed
use_array = _is_array(embed['parent'][property])
KeyError: u'http://schema.org/item'