如何在Java代码中使用OWL API编写过滤正则表达式Snap SPARQL。

huangapple 未分类评论44阅读模式
英文:

How to write filter regex snap sparql in java code using owl api

问题

String sparqlQuery = 
    "SELECT ?resep_makanan\n" +
    "WHERE {\n" +
    "   ?resep_makanan rdf:type :resep_makanan.\n" +
    "   ?resep_makanan :resep_untuk :6-7_bulan.\n" +
    "   ?malnutrisi rdf:type :malnutrisi.\n" +
    "   ?malnutrisi :memiliki_penawar ?resep_makanan.\n" +
    "   FILTER regex(str(?malnutrisi), \"beriberi\")\n" +
    "}\n" +
    "ORDER BY ?resep_makanan;";

Please note that in the provided Java code snippet, the SPARQL query is enclosed within a string variable named sparqlQuery. Make sure to replace the placeholders like :resep_makanan and :6-7_bulan with actual URIs or prefixes that you're using in your OWL ontology. Additionally, the double quotes within the SPARQL query are escaped with a backslash (\") to include them as part of the string.

英文:

oke, i have this snap sparql code

    SELECT ?resep_makanan
WHERE {
	?resep_makanan rdf:type :resep_makanan.
	?resep_makanan :resep_untuk :6-7_bulan.
	?malnutrisi rdf:type :malnutrisi.
	?malnutrisi :memiliki_penawar ?resep_makanan.
	FILTER regex(str(?malnutrisi),"beriberi")
}
ORDER BY ?resep_makanan

it works just fine in protege 5.5.0
how should i write it in java code?
FYI : im using owl api

huangapple
  • 本文由 发表于 2020年4月9日 00:08:17
  • 转载请务必保留本文链接:https://java.coder-hub.com/61105104.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定