Skip to content

Commit

Permalink
#107 Detect implicit typing of collection elements in RDF/XML
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Aug 18, 2020
1 parent 76aaae5 commit 490df39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RDFSharp/Model/Serializers/RDFXml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,11 @@ private static void ParseCollectionElements(Uri xmlBase, XmlNode predNode, RDFRe
//Sanitize eventual blank node or relative value, depending on attribute found
elemUri.Value = ResolveRelativeNode(elemUri, xmlBase);

//Detect implicit typing of elements (node is different from rdf:Description)
if (!elem.Name.Equals(RDFVocabulary.RDF.PREFIX + ":Description", StringComparison.OrdinalIgnoreCase))
// res -> rdf:type -> elem
result.AddTriple(new RDFTriple(new RDFResource(elemUri.Value), RDFVocabulary.RDF.TYPE, new RDFResource(elem.NamespaceURI + elem.LocalName)));

// obj -> rdf:type -> rdf:list
result.AddTriple(new RDFTriple(obj, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.LIST));

Expand Down

0 comments on commit 490df39

Please sign in to comment.