我的 mySQL 数据库中有表,例如:
+-------+------------+-------------+-----------+
| ID | subject | Predicate | object |
+-------+------------+-------------+-----------+
| 1 | ATM | subClassof | Network |
+-------+------------+-------------+-----------+
| 2 | ARPANET | subClassof | Network |
+-------+------------+-------------+-----------+
| 3 | Network | subClassof | Main |
+-------+------------+-------------+-----------+
| 5 | Software | subclassof | Main |
+-------+------------+-------------+-----------+
| 7 | Linux | subClassof | Software |
+-------+------------+-------------+-----------+
| 8 | Windows | subClassof | Software |
+-------+------------+-------------+-----------+
| 12 | XP | subClassof | Windows |
+-------+------------+-------------+-----------+
| 13 | Win7 | subClassof | Windows |
+-------+------------+-------------+-----------+
| 14 | Win8 | subClassof | Windows |
+-------+------------+-------------+-----------+
对于 PredicatesubClassof
它将有一个像这样的树视图:
Main
|__ Network
| |__ ATM
| |__ ARPANET
|
|__ Software
|__ Linux
|__ Windows
|__ XP
|__ Win7
|__ Win8
我想创建一个可以选择起始节点并为此获取所有父节点的表单。例如通过选择Win7
我想得到:
main, Software, Windows,
Win7
Step2:有没有办法用这样的简单文本打印这个节点:
Main
|__ Software
|__ Windows
|__ Win7