我已使用 d2rq 实用程序创建 .ttl 文件,然后将其导入 MarkLofgic 但无法获得所需的结果。
此外,我的数据看起来像这样。
如何从 MySql 数据创建三元组以用于 MarkLogic 中的 SPARQL 中的查询。有人建议我应该将主键值视为主题,将列名视为谓词,将单元格值视为要转换为三元组的对象,但是如何?感谢和问候 Swapneel GOLAPKAR
您在那里显示的是 MarkLogic 将它们存储在数据库中的格式的三元组。确保triple index
为该数据库启用 from Admin ui 以便能够在它们上使用 SPARQL。
启用后,您可以count(cts:triples())
从 QConsole 运行命令来查看已加载了多少三元组,并从那里运行 SPARQL。
您还可以连接到/v1/graphs/sparql
REST 端点。
关于数据应该如何显示为三元组,给定如下两个示例记录(为方便起见,表示为 XML):
<Drug_Dtl>
<Drug_ID>D001</Drug_ID>
<Drug_name>Glyburide 5 mg</Drug_name>
<Brand_name>Diabeta</Brand_name>
<Brand>Novo Nordisk</Brand>
<strength>5 mg</strength>
<NoOfPills>1</NoOfPills>
<TotalDailyDose>5 mg</TotalDailyDose>
<Cost>$51</Cost>
<DailyPills>1</DailyPills>
</Drug_Dtl>
<Prescriber>
<PrescriberId>PSC001</PrescriberId>
<PrescriberName>Wa‌​yne</PrescriberName>
<Prescriber_Address>7 Elgar Center</Prescriber_Address>
<City>Chicago</City>
<State>Illinois</State>
</Prescriber>
我希望三元组类似于(为方便起见表示为海龟):
<D001> <Drug_name> "Glyburide 5 mg".
<D001> <Brand_name> "Diabeta".
<D001> <Brand> "Novo Nordisk".
<D001> <strength> "5 mg".
<D001> <NoOfPills> "1".
<D001> <TotalDailyDose> "5 mg".
<D001> <Cost> "$51".
<D001> <DailyPills> "1".
<PSC001> <PrescriberName> "Wa‌​yne".
<PSC001> <Prescriber_Address> "7 Elgar Center".
<PSC001> <City> "Chicago".
<PSC001> <State> "Illinois".
!