SPARQL:是否同时过滤字符串和整数?

时间:2018-09-04 04:00:11

标签: sparql

我正在对此数据文件使用Protégé测试SPARQL https://raw.githubusercontent.com/miranda-zhang/cloud-computing-schema/master/example/sparql-generate/result/gcloud_vm.ttl

验证了以下作品:

PREFIX cocoon: <https://raw.githubusercontent.com/miranda-zhang/cloud-computing-schema/master/ontology_dev/cocoon.ttl>

SELECT ?VM ?cores
WHERE {
    ?VM a cocoon:VM ;
        cocoon:numberOfCores ?cores .

}

例如,它返回如下内容:

https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-ULTRAMEM-80-PREEMPTIBLE  "80"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-HIGHCPU-64-PREEMPTIBLE   "64"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-STANDARD-2   "2"@    
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-F1-MICRO    "shared"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-HIGHCPU-8-PREEMPTIBLE    "8"@    
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-HIGHCPU-32   "32"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-HIGHMEM-16-PREEMPTIBLE   "16"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-STANDARD-96-PREEMPTIBLE  "96"@   
https://w3id.org/cocoon/data/vm/gcloud/CP-COMPUTEENGINE-VMIMAGE-N1-STANDARD-4   "4"@

我不确定是否可以在?cores上应用过滤器,我尝试了以下操作,但是它们什么也没返回:

cocoon:numberOfCores "shared" .

FILTER(?cores = "4") .

我还想在?cores(即> 4< 8)上应用过滤器,所以我必须将其设置为xsd:integer吗?但是然后我必须摆脱shared的{​​{1}}

1 个答案:

答案 0 :(得分:1)

感谢AKSW,对Protégé的深刻理解。

最后,我将数据类型更改为dbms transaction timeout。似乎已经足够了。