Skip to content

Commit

Permalink
Dev (#343)
Browse files Browse the repository at this point in the history
Remove support for serializing RDF/XML "parseType=Collection"
  • Loading branch information
mdesalvo authored Oct 6, 2024
1 parent 1ca7bfe commit 8cf0354
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 161 deletions.
16 changes: 9 additions & 7 deletions RDFSharp.Test/Model/RDFModelUtilitiesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ public void ShouldDeserializeSPOCollectionFromGraphExitingOnMissingFirst()
}

[TestMethod]
public void ShouldDeserializeSPOCollectionFromGraphExitingOnInvalidItemType()
public void ShouldDeserializeSPOMixedCollectionFromGraph()
{
RDFGraph graph = new RDFGraph(
[
Expand All @@ -1240,9 +1240,10 @@ public void ShouldDeserializeSPOCollectionFromGraphExitingOnInvalidItemType()
RDFCollection coll1 = RDFModelUtilities.DeserializeCollectionFromGraph(graph, new RDFResource("bnode://coll1/"), RDFModelEnums.RDFTripleFlavors.SPO);

Assert.IsNotNull(coll1);
Assert.IsTrue(coll1.ItemsCount == 2);
Assert.IsTrue(coll1.ItemsCount == 3);
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFResource("http://item1/"))));
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFResource("http://item2/"))));
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFPlainLiteral("item3"))));
}

[TestMethod]
Expand All @@ -1257,8 +1258,7 @@ public void ShouldDeserializeEmptySPOCollectionFromGraph()
RDFCollection coll1 = RDFModelUtilities.DeserializeCollectionFromGraph(graph, new RDFResource("bnode://coll1/"), RDFModelEnums.RDFTripleFlavors.SPO);

Assert.IsNotNull(coll1);
Assert.IsTrue(coll1.ItemsCount == 1);
Assert.IsTrue(coll1.Items.Any(x => x.Equals(RDFVocabulary.RDF.NIL)));
Assert.IsTrue(coll1.ItemsCount == 0);
}

[TestMethod]
Expand Down Expand Up @@ -1378,7 +1378,7 @@ public void ShouldDeserializeSPLCollectionFromGraphExitingOnMissingFirst()
}

[TestMethod]
public void ShouldDeserializeSPLCollectionFromGraphExitingOnInvalidItemType()
public void ShouldDeserializeSPLMixedCollectionFromGraph()
{
RDFGraph graph = new RDFGraph(
[
Expand All @@ -1395,9 +1395,10 @@ public void ShouldDeserializeSPLCollectionFromGraphExitingOnInvalidItemType()
RDFCollection coll1 = RDFModelUtilities.DeserializeCollectionFromGraph(graph, new RDFResource("bnode://coll1/"), RDFModelEnums.RDFTripleFlavors.SPL);

Assert.IsNotNull(coll1);
Assert.IsTrue(coll1.ItemsCount == 2);
Assert.IsTrue(coll1.ItemsCount == 3);
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFPlainLiteral("item1"))));
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFPlainLiteral("item2"))));
Assert.IsTrue(coll1.Items.Any(x => x.Equals(new RDFResource("http://item3/"))));
}

[TestMethod]
Expand All @@ -1412,7 +1413,8 @@ public void ShouldDeserializeEmptySPLCollectionFromGraph()
RDFCollection coll1 = RDFModelUtilities.DeserializeCollectionFromGraph(graph, new RDFResource("bnode://coll1/"), RDFModelEnums.RDFTripleFlavors.SPL);

Assert.IsNotNull(coll1);
Assert.IsTrue(coll1.ItemsCount == 0); }
Assert.IsTrue(coll1.ItemsCount == 0);
}

[TestMethod]
public void ShouldDetectSPOCollectionFlavorFromGraph()
Expand Down
Loading

0 comments on commit 8cf0354

Please sign in to comment.