private object ProcessNode(NavigationPropertyNode navigation) { var source = navigation.Source == null ? _entitySetVariable : ProcessNode(navigation.Source); if (source != null) { IPatternItem sourcePatternItem = source is Uri ? (IPatternItem) new UriPatternItem(source.ToString()) : new VariablePatternItem(source.ToString()); string propertyUri; bool isInverse; string targetVar = _sparqlModel.NextVariable(); _map.TryGetUriForNavigationProperty(navigation.NavigationProperty.DeclaringEntityType().FullName(), navigation.NavigationProperty.Name, out propertyUri, out isInverse); if (isInverse) { // Target is the subject of a triple _sparqlModel.CurrentGraphPattern.Add( new TriplePattern(new VariablePatternItem(targetVar), new UriPatternItem(propertyUri), sourcePatternItem)); } else { _sparqlModel.CurrentGraphPattern.Add( new TriplePattern(sourcePatternItem, new UriPatternItem(propertyUri), new VariablePatternItem(targetVar))); } return(targetVar); } throw new Exception("Cannot process navigation node as source could not be processed."); }
public TriplePattern(IPatternItem subject, IPatternItem predicate, IPatternItem @object) { Subject = subject; Predicate = predicate; Object = @object; }