Skip to content

Commit

Permalink
[Bug #51] Fix the issue of attempting to add JSON-LD context to a col…
Browse files Browse the repository at this point in the history
…lection node.
  • Loading branch information
ledsoft committed Mar 30, 2023
1 parent f8bf4f6 commit 20a3bac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public void closeObject(SerializationContext<?> ctx) {
if (!ctx.isCurrentEmpty()) {
currentNode.prependItem(ctx.getContextNode());
}
closeCurrentNode();
}

private void closeCurrentNode() {
currentNode.close();
if (!nodeStack.empty()) {
this.currentNode = nodeStack.pop();
Expand Down Expand Up @@ -126,7 +130,7 @@ public void openCollection(SerializationContext<? extends Collection<?>> ctx) {
@Override
public void closeCollection(SerializationContext<?> ctx) {
assert currentNode instanceof CollectionNode;
closeObject(ctx);
closeCurrentNode();
}

public CompositeNode<?> getTreeRoot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import cz.cvut.kbss.jsonld.environment.Vocabulary;
import cz.cvut.kbss.jsonld.environment.model.*;
import cz.cvut.kbss.jsonld.serialization.context.DummyJsonLdContext;
import cz.cvut.kbss.jsonld.serialization.context.MappingJsonLdContextFactory;
import cz.cvut.kbss.jsonld.serialization.model.*;
import cz.cvut.kbss.jsonld.serialization.serializer.LiteralValueSerializers;
import cz.cvut.kbss.jsonld.serialization.serializer.compact.DefaultValueSerializer;
Expand Down

0 comments on commit 20a3bac

Please sign in to comment.