From 490df391ccc5b5f69a1f099f909d52a5f5c31b83 Mon Sep 17 00:00:00 2001 From: mdesalvo Date: Tue, 18 Aug 2020 12:39:11 +0200 Subject: [PATCH] #107 Detect implicit typing of collection elements in RDF/XML --- RDFSharp/Model/Serializers/RDFXml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RDFSharp/Model/Serializers/RDFXml.cs b/RDFSharp/Model/Serializers/RDFXml.cs index cd7c5277..b17f9bf5 100644 --- a/RDFSharp/Model/Serializers/RDFXml.cs +++ b/RDFSharp/Model/Serializers/RDFXml.cs @@ -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));