我在Virtuoso开源07.20.3217版本中存储了一组本体和RDF数据。即,这些是我存储的本体:
我想将所有这些本体和RDF数据加载到模型中,应用推理器来推断新数据,并通过推理在此类新模型上应用SPARQL。为了完成第一部分,我使用以下代码(可以在许多教程中找到)。
//Connect to Virtuoso and retrieve data stored in "GRAPH_NAME"
Model model = VirtModel.openDatabaseModel(GRAPH_NAME, URL, USERNAME, PASSWORD);
//Create an ontology model based on the loaded data
OntModel mod1 = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, model);
//Create an OWL reasoner
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
reasoner = reasoner.bindSchema(mod1);
//Apply the reasoner to the model
InfModel inf = ModelFactory.createInfModel(reasoner, mod1);
(...)
实际上,我已经尝试了此代码的许多变体。但是,在执行bindSchema()
函数时,总是会遇到相同的错误:
com.hp.hpl.jena.shared.JenaException: virtuoso.jdbc4.VirtuosoException:
SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '_' before ':'
有人遇到同样的问题吗?