/// <summary> /// Generates the triples. /// </summary> /// <param name="outputGraph">The Rdf graph.</param> private void GenerateTriples(Graph outputGraph) { //If there are no attributes or only the optional rdf:ID attribute i then //o := literal(literal-value:="", literal-language := e.language) and //the following statement is added to the graph: //e.parent.subject.string-value e.URI-string-value o.string-value . EventAttribute i = innerElement.Attributes. Where(tuple => tuple.Uri == IDUri).FirstOrDefault(); if (innerElement.Attributes.Count() == 0 || (innerElement.Attributes.Count() == 1 && i != null)) { Subject s = innerElement.Parent.Subject; RDFUriReference p = innerElement.Uri; Node o = new PlainLiteral(string.Empty, innerElement.Language); AddTriple(outputGraph, s, p, o); //and then if i is given, the above statement is reified with //uri(identifier := resolve(e, concat("#", i.string-value))) //using the reification rules if (i != null) { RDFUriReference elementUri = Production.Resolve(innerElement, ("#" + i.StringValue)); Production.Reify(s, p, o, elementUri, outputGraph); } } else { Subject r = GetSubject(); //For all propertyAttr attributes a (in any order) //If a.URI == rdf:type then u:=uri(identifier:=resolve(a.string-value)) and the following triple is added to the graph: //r.string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> u.string-value . //Otherwise Unicode string a.string-value SHOULD be in Normal Form C[NFC], //o := literal(literal-value := a.string-value, literal-language := e.language) and the following statement is added to the graph: //r.string-value a.URI-string-value o.string-value . //propertyAttr = anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms ) IEnumerable <EventAttribute> propertyAttr = innerElement.Attributes. Where(tuple => tuple.Uri != DescriptionUri && tuple.Uri != LiUri && (Production.CoreSyntaxTerms.Where(attr => attr == tuple.Uri).Count() == 0) && (Production.OldTerms.Where(attr => attr == tuple.Uri).Count() == 0)); foreach (EventAttribute a in propertyAttr) { if (a.Uri == TypeUri) { RDFUriReference u = Production.Resolve(innerElement, a.StringValue); AddTriple(outputGraph, r, TypeUri, u); } //Attributes except rdf:resource and rdf:nodeID else if (!(a.Uri == ResourceUri || a.Uri == NodeIDUri)) { Node literal = new PlainLiteral(a.StringValue, innerElement.Language); AddTriple(outputGraph, r, a.Uri, literal); } } //Add the following statement to the graph: //e.parent.subject.string-value e.URI-string-value r.string-value . //and then if rdf:ID attribute i is given, the above statement is reified with uri(identifier := resolve(e, concat("#", i.string-value))) using the reification rules Subject s = innerElement.Parent.Subject; RDFUriReference p = innerElement.Uri; Node o = r; AddTriple(outputGraph, s, p, o); if (i != null) { RDFUriReference elementUri = Production.Resolve(innerElement, ("#" + i.StringValue)); Production.Reify(s, p, o, elementUri, outputGraph); } } }