我试图将参数化查询传递给 dotNetRDF 中的 ExecuteQery() 函数
我的代码是
preference = (d1.send()); // d1.send(); method returns a string value
SparqlParameterizedString queryString = new SparqlParameterizedString();
queryString.CommandText = @"
PREFIX my: <http://www.codeproject.com/KB/recipes/n3_notation#>
SELECT ?name WHERE { [ a my:spec; my:preferedby my:@variable; my:name ?name]. }";
queryString.SetVariable("variable", preference );
我不能preference
在函数的第二个参数中设置变量,SetVariable
因为它说它是一个无效的参数。我在文档中读到,参数必须是一个INode
值,我尝试使用获取变量的 INodepreference
值
INode value = preference.Value("var");
但它无法完成,因为它显示错误“String does not contain a definition for value"
有人可以帮我获取此字符串变量的 INode 值或如何SetVariable
正确调用此方法