Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding stubs to process props (keys and values)

  • Loading branch information...
commit d29373be894eec988ebae5b8bc72371141a79b14 1 parent 4bdd706
@nrdufour authored
Showing with 25 additions and 2 deletions.
  1. +25 −2 src/jsonld_normalize.erl
View
27 src/jsonld_normalize.erl
@@ -79,10 +79,27 @@ process_subject(JsonObject, ObjectCtx) ->
urdf_util:new_bnode()
end.
-extract_normalized_objects(Subject, Object, _ObjectCtx, State) ->
+extract_normalized_objects(Subject, Object, ObjectCtx, State) ->
ObjectWithSubject = [ { <<"@subject">>, [ { <<"@iri">>, Subject } ] } ],
- NormalizedObject = ObjectWithSubject,
+ NormalizedObject = lists:foldl(
+ fun({Key, Value}, ObjectBeingBuilt) ->
+ case Key of
+ <<"@subject">> ->
+ ObjectBeingBuilt;
+ <<"@context">> ->
+ ObjectBeingBuilt;
+ _ ->
+ Property = {
+ extract_property_key(Key, ObjectCtx),
+ extract_property_value(Value, ObjectCtx)
+ },
+ ObjectBeingBuilt ++ [Property]
+ end
+ end,
+ ObjectWithSubject,
+ Object
+ ),
% Append the object to the list
NodeId = Subject,
@@ -90,3 +107,9 @@ extract_normalized_objects(Subject, Object, _ObjectCtx, State) ->
State#state{ nodes = UpdatedList }.
+extract_property_key(Key, ObjectCtx) ->
+ Key.
+
+extract_property_value(Value, ObjectCtx) ->
+ Value.
+
Please sign in to comment.
Something went wrong with that request. Please try again.