我正在使用phantomJS通过shell(shell_exec)在PHP中创建PDF .该脚本在生产服务器上运行正常,如果我将PhantomJS命令直接插入终端,也可以正常工作.
但是当我在本地开发环境中运行脚本时,它不起作用.我想知道是否涉及权限问题.我现在不会深入了解当地环境的细节,因为我猜这是一个高级问题......
应该通过shell_exec()以下命令执行的命令:
/usr/local/bin/phantomjs --ignore-ssl-errors=true --debug=true ../scripts/renderTeamProfile.js https://127.0.0.1/app_dev.php/pdf/enterprise-lpc-enterprise/profile/render /private/var/tmp/pjsK2N16E.pdf
该php代码:
public function pdfResponse($url, $script, $remote_filename)
{
$tempFile = tempnam('/tmp', 'pjs');
// The extension specifies output format. Use pdf
$tempFilePdf = $tempFile . '.pdf';
rename($tempFile, $tempFilePdf);
# nginx should restrict access to the localhost URL
$urlLocal = preg_replace('/^https:..[^\/]+/', 'https://127.0.0.1', $url);
$phantomJs = $this->container->getParameter('testsite.phantomjs_cmd');
$command = $phantomJs.' --debug=true '.$script.' '.$urlLocal.' '.$tempFilePdf;
$output = shell_exec($command);
$content = file_get_contents($tempFilePdf);
$response = new Response($content, 200);
$response->headers->set('Content-Type', 'application/pdf');
$response->headers->set('Content-Disposition', …Run Code Online (Sandbox Code Playgroud) 我想从 dbpedia 端点获取数据,在 vue js 中使用 axios。
我曾经axios.get从 dbpedia 获取数据,但在控制台中出现错误提示:
类型错误:name.toUpperCase 不是函数
我该如何解决?
created(){
this.fetch();
},
methods: {
fetch(){
axios
.get('http://id.dbpedia.org/sparql?query=SELECT+DISTINCT+?concept+WHERE+{+?s+a+?concept+}+LIMIT+50', {
headers: 'Access-Control-Allow-Origin: *'
}).then(response => {
/* eslint-disable */
console.log('SUCCESS');
console.log(response);
}).catch((e) => {
console.log(e);
})
}
},
Run Code Online (Sandbox Code Playgroud) 我一直在使用OpenLink Virtuoso作为RDF存储一段时间虽然它对于大数据很好,但我对使用SPARQL的图形遍历性能不满意.最近我听说过Neo4j的遍历性能,并认为值得一试.因此,为了拥有一个具有良好遍历性能的大型RDF存储,切换到Neo4j会更好吗?
我不知道Neo4j的大数据性能,Neo4j的RDF/SPARQL部分看起来并不成熟.谢谢你的时间.
我们创建了一个SPARQL端点,dotnetrdf并且在与SPARQL相关时我是初学者.日期字段已存储为格式的字符串MM/DD/YYYY.现在,需要日期比较(> <),必须将字符串转换为SPARQL查询xsd:datetime或xsd:date在SPARQL查询中.有没有办法做到这一点?还有其他选择吗?
是否有与日期相关的SPARQL查询可用的好例子dotnetrdf?
谢谢.
我需要在 DBpedia 上找到所有的三元组,其中http://dbpedia.org/resource/Benin是一个主题或对象。这个查询以最适合我的格式提供了我想要的输出(只有三个变量,没有空格):
PREFIX : <http://dbpedia.org/resource/>
SELECT * WHERE {
?s ?p ?o
FILTER (?s=:Benin OR ?o=:Benin)
}
Run Code Online (Sandbox Code Playgroud)
如果我有这个查询,我会得到类似的结果:
PREFIX : <http://dbpedia.org/resource/>
SELECT * WHERE {
{:Benin ?p ?o}
UNION
{?s ?p :Benin}
}
Run Code Online (Sandbox Code Playgroud)
但是,后者的格式是关闭的。它首先让我p和o输出,保留s空白,然后s和p留下o的空白。此外,第一个查询需要更多时间来执行。我将非常感谢您对这两个查询如何工作的机制以及输出为何存在差异的解释。
我正在尝试使用 pyodbc 在便携式应用程序中连接到 SQL Server(通过 FreeTDS 的 MS SQL Server);因为它应该是独立的,所以我想避免在系统上显式安装驱动程序,只需将 ODBC 驱动程序 dll 随应用程序一起带上即可。
此页面建议可以直接在连接字符串中指定驱动程序 dll
在函数的
DRIVER=参数中指定参数。例如:szConnStrInSQLDriverConnectRun Code Online (Sandbox Code Playgroud)szConnStrIn = "driver=ospath/dbodbc6.dll;dbf=c:\asademo.db"
ospathAdaptive Server Anywhere 安装目录的操作系统子目录在哪里。
libtdsodbc.so在 Linux 上通过 pyodbc+进行尝试,效果很好;然而,在 Windows (pyodbc+ tdsodbc.dll)上尝试同样的方法我总是得到
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] 未找到数据源名称且未指定默认驱动程序 (0) (SQLDriverConnect)')
(libtdsodbc.so不过,我似乎很好,因为,如果我将其安装为“常规”驱动程序并使用其名称引用它,则它可以正常连接)
检查和相关页面的文档,SQLDriverConnect没有提到DRIVER=直接与 dll 路径一起使用的选项。
那么,Windows 不支持“直接到驱动程序-dll”连接吗?是否有任何替代方法,尤其是使用 Python 直接连接到驱动程序 dll,绕过 ODBC 驱动程序管理器?
我收到以下错误.
Virtuoso 22007 Error DT006: Cannot convert -0359 to datetime : Incorrect month field length
SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define sql:signal-void-variables 1 select ?item bif:year(xsd:dateTime( str(?dob))) as ?m{
?item <h://f.cm/ns/common/topic/notable_types> <h://f.cm/ns/people/person> .
?item <h://f.cm/ns/people/person/date_of_birth> ?dob
} limit 675
Run Code Online (Sandbox Code Playgroud)
如果我将限制更改为674,则可以.
我怀疑是某个日期时间字段在某处错误并打印出来?dob,这表明其中一个值是-0359.
解决方案是在应用bif函数之前验证值.
但是,我们如何在SPARQL中验证日期时间?
考虑具有根节点“A”和“hasChild”关系(例如产品结构)的树如下:

目标是找出:哪些节点在树外有父节点?
在这种情况下,答案应该是“B”和“Q”,因为它们在树外有父母。
查询应该去每个节点并检查它的父节点,而不是创建一个子节点列表并检查每个节点我猜。
我怎样才能有效地(应该为数百万个节点工作)用 SPARQL 遍历这棵树并回答这个问题?
这是我尝试过的,但结果为 0:
PREFIX xxx: <http://example.org/xxx#>
select * where {
xxx:A xxx:hasChild* ?child .
?child ^xxx:hasChild ?foreignParent .
?child ^xxx:hasChild ?parent .
FILTER (?parent =! ?foreignParent) .
}
Run Code Online (Sandbox Code Playgroud)
附上各自的样本数据:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xxx="http://example.org/xxx#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xml:base="http://example.org/xxx">
<owl:Ontology rdf:about="">
<owl:versionInfo>Created with TopBraid Composer</owl:versionInfo>
</owl:Ontology>
<owl:Class rdf:ID="Other">
<rdfs:label>Other</rdfs:label>
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>
<owl:Class rdf:ID="Item">
<rdfs:label>Item</rdfs:label>
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>
<rdf:Property rdf:ID="hasChild">
<rdfs:range rdf:resource="#Item"/>
<rdfs:range rdf:resource="#Other"/>
<rdfs:domain rdf:resource="#Item"/>
<rdfs:label>has child</rdfs:label>
</rdf:Property>
<xxx:Other rdf:ID="Fake_1">
<xxx:hasChild>
<xxx:Item rdf:ID="B">
<xxx:hasChild> …Run Code Online (Sandbox Code Playgroud) sparql ×6
rdf ×4
dbpedia ×3
semantic-web ×2
virtuoso ×2
allegrograph ×1
axios ×1
date ×1
dotnetrdf ×1
freebase ×1
jena ×1
linked-data ×1
neo4j ×1
odbc ×1
performance ×1
phantomjs ×1
php ×1
pyodbc ×1
python ×1
triplestore ×1
turtle-rdf ×1
vue.js ×1
windows ×1