我有一个简单的n3本体
@prefix my: <http://www.codeproject.com/KB/recipes/n3_notation#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
my:spec a rdfs:Class.
my:security a rdfs:Class; rdfs:subClassOf my:spec .
my:bluetooth a my:security;
my:preferedby my:BusinessPerson;
my:name "bluetooth".
我试图定义类规范并将安全类定义为规范的子类。
这是我在dotNetRdf库
的帮助下使用的sparql查询PREFIX my: <http://www.codeproject.com/KB/recipes/n3_notation#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?name WHERE {
[ a rdfs:subClassOf*/my:spec;
my:preferedby my:BusinessPerson;
my:name ?name].
}
我使用dotnetrdf库来查询我的本体和
Graph g2 = new Graph();
g2.LoadFromFile(@"C:\\Users\Ravindu Kottahachchi\Desktop\ontology.n3");
ISparqlDataset ds = new InMemoryDataset(g2);
LeviathanQueryProcessor processor = new LeviathanQueryProcessor(ds);
SparqlResultSet resul = processor.ProcessQuery(query1) as SparqlResultSet;
如果我查询查询而不使用任何标记来指示路径基数
,此设置可以正常工作但是当我运行上面提到的查询时,它会给出错误VDS.RDF.Parsing.Tokens.MultiplyToken' Token which is valid only after a Predicate to indicate Path Cardinality
使用dotnetrdf设置是否有问题?
我用过这个
TripleStore store = new TripleStore();
Graph g = new Graph();
Notation3Parser parser = new Notation3Parser();
parser.Load(g, @"C:\\Users\Ravindu Kottahachchi\Desktop\ontology.n3");
store.Add(g);
SparqlQueryParser sparqlparser = new SparqlQueryParser();
SparqlResultSet results = store.ExecuteQuery(query) as SparqlResultSet;
使用具有相同sparql查询的三重存储但它也给出了相同的错误
有人可以提前帮助我解决错误的地方