我的目标:为 Windows10-64bit 构建一个使用 Unity 和 dotNetRDF 一起管理 Fuseki 三元存储的应用程序。
Unity 2017.3 64 位
脚本运行时版本:实验性(.NET 4.6 等效)
脚本后端:Mono
API 兼容级别:.NET 4.6dotNetRFD v2.0.1
我保留了所有与 net40 关联的 dll。
Unity“游戏”由一个按钮组成,该按钮具有下面提供的代码。当我运行游戏并按下按钮时,我收到以下错误:
System.InvalidOperationException: request started
at System.Net.HttpWebRequest.CheckRequestStarted ()
at System.Net.HttpWebRequest.set_Accept (System.String value)
与按钮关联的 NewBehaviourScript 类的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OntSenseCSharpAPI;
using System;
using VDS.RDF.Query;
using VDS.RDF.Update;
public class NewBehaviourScript : MonoBehaviour {
private SparqlRemoteUpdateEndpoint endpoint;
// Use this for initialization
void Start() {
// Start access to Sparql End Point : just one time at main method is enough
endpoint = new SparqlRemoteUpdateEndpoint("http://localhost:3030/test/update");
}
// Update is called once per frame
void Update() {
}
public void oneTriple() {
String updateCmd =
"PREFIX ontsense: < http://example.org/sense#> " +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"INSERT DATA" +
" {" +
" ontsense: dotNetRDF rdf:comment \"dotNetRDF is a great tool.\"@en . " +
"}";
print(updateCmd);
try
{ // Try to access a resource.
endpoint.Update(updateCmd);
}
catch (Exception e)
{
print(e); // // Call a custom error logging procedure.
throw; // Re-throw the error. It is likely to interrupt the application
}
}
}
请注意,如果我使用 dotNetRDF 包创建单独的 Visual Studio 项目,则与 Sparql 端点的交互可以完美运行。
目前,我已采用该解决方案来构建该应用程序。因此,我的系统与一个应用程序一起工作,该应用程序接收通过套接字从 Unity 发送的 Sparql 更新命令。当然不是理想的形式,但在获得问题的最终解决方案之前,它将被使用。