小编ERG*_*ERG的帖子

SPARQL:如果类层次结构的深度未知,如何获得本体的概念?

我有一个关于SPARQL的问题.我有动物的本体论:

Animals  (is a superclass with object property <hasColor>)
------ Mammals (subclass of Animals)
------------- Dog (subclass of Mammals)
---------------- dog1 (a instance with property <hasColor>="white")
---------------- dog2 (a instance with property <hasColor>="red"   )
------ Bird (subclass of Animals)
Run Code Online (Sandbox Code Playgroud)

是否有可能找到SPARQL"所有动物,'白''或"所有动物实例"?倒退:我怎么知道,如果一个实例(dog1)属于动物?

注意:类层次结构的深度和广度是事先未知的.

此外,下面的查询将无法正常工作

SELECT ?x WHERE  {?x rdfs:subClassOf  :Animals .  ?x :has?olor "white"}
Run Code Online (Sandbox Code Playgroud)

并且下一个查询(查找所有动物,即'白色')仅在已知类层次结构的深度时才起作用.(所以,如果层次结构是已知的,我可以让指定的步骤(从层次结构底部的顶部)要达到的目标:在这种情况下,2个步骤.

SELECT ?z WHERE  {
?x  rdfs:subClassOf :Animals .
?y  rdfs:subClassOf ?x .
?z  rdf:type ?y .
?z :hasColor "white"
}
Run Code Online (Sandbox Code Playgroud)

下一个例子也是如此 - "查找动物的所有实例"

SELECT ?z WHERE …
Run Code Online (Sandbox Code Playgroud)

ontology sparql jena semantics

6
推荐指数
1
解决办法
6080
查看次数

如何在Node.js上更改接收POST数据的大小限制

我的Angularjs应用将XML字符串作为POST数据发送到Node.js服务器。

var xmlString = (new XMLSerializer()).serializeToString(xmlData);
var fd = new FormData();
fd.append('xml', xmlString);
$http.post("/saveXML", fd, {
    transformRequest: angular.identity,
    headers: {'Content-Type': undefined}
}).success(function (response) {
    console.log('xml uploaded!!', response);
}).error(function (error) {
    console.log("Error while uploading the xml!");
});
Run Code Online (Sandbox Code Playgroud)

然后Node.js接收数据并将其写入文件。

app.post('/saveXML', function (request, response) {
    var xmlData = request.body.xml;
    console.log(request.body);
    fs.writeFile("./uploads/mergedXml.xml", xmlData, function(wError){
        if (wError) {
            console.log(wError.message);
            response.send({
                success: false,
                message: "Error! File not saved!"

            });
            throw wError;
        }
        console.log("success");
        response.send({
            success: true,
            message: "File successfully saved!"
        });
    });
});
Run Code Online (Sandbox Code Playgroud)

问题是,如果发送的XML字符串(POST xml数据)大于1MB,则Node.js(?)将其截断为1MB …

post node.js angularjs

0
推荐指数
1
解决办法
1249
查看次数

标签 统计

angularjs ×1

jena ×1

node.js ×1

ontology ×1

post ×1

semantics ×1

sparql ×1