【问题标题】:RDFazer show no results ( syntax error in the query )RDFazer 不显示任何结果(查询中的语法错误)
【发布时间】:2018-08-20 14:52:36
【问题描述】:

这是我第一次研究本体。 我下载了 Virtuoso,还有 RDFazer,它可以帮助我找到与 ESCO 本体匹配的术语。 这是默认的 JSON 文件(包括查询语句),我根本没有改变它:

{
"sparql": "http://localhost:8890/sparql",
"fileURI": "",
"profile": "ESCO (virtuoso)",
"profiles": {
    "ESCO (virtuoso)": {
        "query": "select ?target ?label (group_concat(distinct(?labels); separator=\"| \") as ?altLabels) (group_concat(distinct(?types); separator=\"| \") as ?types)\n where { \n{ ?target a <http://ec.europa.eu/esco/model#Occupation> . } \nUNION\n { ?target a <http://ec.europa.eu/esco/model#Skill> . } \n?target <http://www.w3.org/2008/05/skos-xl#prefLabel> ?thing3. ?thing3 <http://www.w3.org/2008/05/skos-xl#literalForm> ?label .\n ?target <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?types .\n{ ?target <http://www.w3.org/2008/05/skos-xl#prefLabel> ?thing1. \n?thing1 <http://www.w3.org/2008/05/skos-xl#literalForm> ?plabels . \nFILTER (bif:contains(?plabels,\"'$searchTerm*'\")) . \nFILTER (lang(?plabels) = \"en\") . } \nUNION\n { ?target <http://www.w3.org/2008/05/skos-xl#altLabel> ?thing2.\n ?thing2 <http://www.w3.org/2008/05/skos-xl#literalForm> ?plabels .\n FILTER (bif:contains(?plabels,\"'$searchTerm*'\")) . \nFILTER (lang(?plabels)= \"en\") . \n} \nOPTIONAL {?target <http://www.w3.org/2008/05/skos-xl#altLabel> ?thing4\n. ?thing4 <http://www.w3.org/2008/05/skos-xl#literalForm> ?labels\n. FILTER (lang (?labels) = \"en\") \n}\nFILTER (lang (?label) = \"en\") \n} GROUP BY ?target ?label",
        "uriToUrl": "'https://ec.europa.eu/esco/web/guest/concept/-/concept/thing/en/' +uri",
        "labelProperty": "label",
        "labelPredicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
        "storedInfo": {
            "label": {
                "predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
                "type": "property",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "altLabels": {
                "predicate": "http://www.w3.org/2004/02/skos/core#altLabel",
                "type": "property",
                "csv": "|",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "types": {
                "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
                "type": "relation",
                "csv": "|"
            }
        }
    },
    "default (skos)": {
        "query": "select ?target ?label (group_concat(distinct(?labels); separator=\"| \") as ?altLabels)\n (group_concat(distinct(?types); separator=\"| \") as ?types) where {\n ?target <http://www.w3.org/2004/02/skos/core##prefLabel> ?label .\n ?target <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?types .\n{ ?target <http://www.w3.org/2004/02/skos/core#prefLabel> ?plabels .\n FILTER (bif:contains(?plabels,\"'$searchTerm*'\")) . }\n UNION {\n ?target <http://www.w3.org/2004/02/skos/core#altLabel> ?plabels .\n FILTER (bif:contains(?plabels,\"'$searchTerm*'\")) .\n } OPTIONAL {\n?target <http://www.w3.org/2004/02/skos/core#altLabel> ?labels.\n FILTER (lang (?labels) = \"en\") }\nFILTER (lang (?label) = \"en\") \n} GROUP BY ?target ?label",
        "uriToUrl": "uri",
        "labelProperty": "label",
        "labelPredicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
        "storedInfo": {
            "label": {
                "predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
                "type": "property",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "altLabels": {
                "predicate": "http://www.w3.org/2004/02/skos/core#altLabel",
                "type": "property",
                "csv": "|",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "types": {
                "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
                "type": "relation",
                "csv": "|"
            }
        }
    },
    "ESCO (pure SPARQL 1.1)": {
        "query": "select ?target ?label (group_concat(distinct(?labels); separator=\"| \") as ?altLabels) (group_concat(distinct(?ttypes); separator=\"| \") as ?types)\nwhere { \n{ ?target a <http://ec.europa.eu/esco/model#Occupation> . } \nUNION\n{ ?target a <http://ec.europa.eu/esco/model#Skill> . } \n?target <http://www.w3.org/2008/05/skos-xl#prefLabel> ?thing3. ?thing3 <http://www.w3.org/2008/05/skos-xl#literalForm> ?label .\n?target <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?ttypes .\n{ ?target <http://www.w3.org/2008/05/skos-xl#prefLabel> ?thing1. \n?thing1 <http://www.w3.org/2008/05/skos-xl#literalForm> ?plabels . \n} UNION\n{ ?target <http://www.w3.org/2008/05/skos-xl#altLabel> ?thing2.\n?thing2 <http://www.w3.org/2008/05/skos-xl#literalForm> ?plabels .\n} \nFILTER (regex(?plabels,\".*$searchTerm.*\",\"i\")) . \nFILTER (lang(?plabels) = \"en\") . \nOPTIONAL {?target <http://www.w3.org/2008/05/skos-xl#altLabel> ?thing4\n. ?thing4 <http://www.w3.org/2008/05/skos-xl#literalForm> ?labels\n. FILTER (lang (?labels) = \"en\") \n}\nFILTER (lang (?label) = \"en\") \n} GROUP BY ?target ?label",
        "uriToUrl": "'https://ec.europa.eu/esco/web/guest/concept/-/concept/thing/en/' +uri",
        "labelProperty": "label",
        "labelPredicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
        "storedInfo": {
            "label": {
                "predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
                "type": "property",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "altLabels": {
                "predicate": "http://www.w3.org/2004/02/skos/core#altLabel",
                "type": "property",
                "csv": "|",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "types": {
                "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
                "type": "relation",
                "csv": "|"
            }
        }
    },
    "ESCO (fuseki, text index)": {
        "query": "select ?target ?label (group_concat(distinct(?labels); separator=\"| \") as ?altLabels) (group_concat(distinct(?ttypes); separator=\"| \") as ?types)\nwhere { \n{ ?target a <http://ec.europa.eu/esco/model#Occupation> . } \nUNION\n{ ?target a <http://ec.europa.eu/esco/model#Skill> . } \n?target <http://www.w3.org/2008/05/skos-xl#prefLabel> ?thing3. ?thing3 <http://www.w3.org/2008/05/skos-xl#literalForm> ?label .\n?target <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?ttypes .\n?target <http://jena.apache.org/text#query> \"$searchTerm\". \nOPTIONAL {?target <http://www.w3.org/2008/05/skos-xl#altLabel> ?thing4\n. ?thing4 <http://www.w3.org/2008/05/skos-xl#literalForm> ?labels\n. FILTER (lang (?labels) = \"en\") \n}\nFILTER (lang (?label) = \"en\") \n} GROUP BY ?target ?label",
        "uriToUrl": "'https://ec.europa.eu/esco/web/guest/concept/-/concept/thing/en/' +uri",
        "labelProperty": "label",
        "labelPredicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
        "storedInfo": {
            "label": {
                "predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
                "type": "property",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "altLabels": {
                "predicate": "http://www.w3.org/2004/02/skos/core#altLabel",
                "type": "property",
                "csv": "|",
                "decorate": {
                    "xml:lang": "en"
                }
            },
            "types": {
                "predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
                "type": "relation",
                "csv": "|"
            }
        }
    }
}

}

我多次尝试查询。我现在没有说如图所示的语法错误(抱歉,我无法复制错误,我只能截屏)

有什么办法可以修复这个错误吗?

非常感谢。

【问题讨论】:

  • 首先想到的是您可能正在运行不支持 SPARQL 1.1 的旧版 Virtuoso,因此在此位置不支持 group_concat。可以通过virtuoso-t -?a SPARQL query查看版本。
  • 您的 SPARQL 查询不正确。看起来所有 URI &lt;...&gt; 都被跳过了,你有“情侣”模式而不是三重模式。
  • 错误消息中报告的 SPARQL 查询与代码 sn-p 中的内容不匹配。正如@StanislavKralin 所说,缺少尖括号包裹的URI。鉴于您所描述的互动,我无法很快想到为什么会这样,所以也许您可以提供更多关于您已采取的步骤的详细信息?您还可以尝试直接通过基于 HTTP 的 /sparql 端点测试 SPARQL 查询,以尝试缩小问题所在/出现的范围。
  • 感谢您的回复。据我所知,RDFazer 是谷歌浏览器插件。我认为我不需要更改文档 (github.com/Rahien/RDFazer) 中显示的任何内容,ESCO 包括技能术语列表(技能,如 c++、编程语言、.. 等),并且此工具匹配并显示任何术语与 ESCO 的网页。正如@TallTed 提到的那样,我将大师更新到了较新的版本,并且错误消失了。但仍然没有显示结果我不知道为什么。
  • 那个 RDFazer 页面说,它“用于用 RDFa 概念标记网站”并且“目前是一个 WIP,只有在你知道自己在做什么的情况下才应该使用它。”我想知道对于早期项目使用其他一些工具是否会更好?你想做什么? (可能一个新问题会是一个更好的地方来挖掘这个......)

标签: sparql rdf ontology virtuoso


【解决方案1】:

解决方案是将明显旧的 Virtuoso 更新到当前版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-11
    • 1970-01-01
    • 2017-05-15
    • 2020-09-20
    • 1970-01-01
    • 2018-01-19
    • 1970-01-01
    相关资源
    最近更新 更多