我可以编写一个SPARQL查询来将单个三元组中的单词中的单词连接成单个句子:
SELECT ?sent (sample (?sf1) as ?sf11) (group_concat(?wf) as ?sf2)
WHERE
{ ?sent a nlp:Sentence .
{select *
{ ?w rdfs:partOf ?sent .
?w a nlp:Token .
?w nlp:wordForm ?wf .
} order by ?w
}
} group by ?sent
limit 20
但是我找不到在另一个查询中使用这个select语句的方法,在那里我找到句子?sent
并想插入这个select语句:
select *
where
{ ?tok a wn:Locomote.
?tok nlp:lemma3 ?lem .
?tok rdfs:partOf ?sent .
?sent a nlp:Sentence .
?werk ^rdfs:partOf ?sent .
{SELECT ?sent (group_concat(?wf) as ?sf2)
WHERE
{ ?sent a nlp:Sentence .
{select *
{ ?w rdfs:partOf ?sent .
?w a nlp:Token .
?w nlp:wordForm ?wf .
} order by ?w
}
} group by ?sent
}
}
结果不是第一部分中找到的句子,但似乎嵌套查询中的?sent
不受外部查询的限制。
我没有看到如何正确嵌套。
谢谢你的帮助!
答案 0 :(得分:2)
Example of custom aggregate in Jena:
<TestMethod()> Public Sub ElementTypeUnitTestAsync()
Dim RoslynPath As String = Path.Combine(RepoPath, SolutionPartialPath)
Dim MS_Workspace As MSBuildWorkspace = MSBuildWorkspace.Create()
AddHandler MS_Workspace.WorkspaceFailed, Sub(sender As Object, e As WorkspaceDiagnosticEventArgs)
Debug.WriteLine(e.Diagnostic.ToString())
End Sub
Dim NewSolution As Solution = MS_Workspace.OpenSolutionAsync(RoslynPath).Result
End Sub