创建、可视化和查询简单的数据结构

发布于 2024-09-17 06:06:08 字数 1197 浏览 9 评论 0原文

简单且常见的树状数据结构

数据结构示例

Animated Cartoons have 4 extremities (arm, leg,limb..)
Human have 4 ext.
Insects have 6 ext.
Arachnids have 6 ext.

Animated Cartoons have 4 by extremity
Human have 5 by ext.
Insects have 1 by ext.
Arachnids have 1 by ext.

某种实现

Level/Table0 
              Quantity, Item
Level/Table1
              ItemName, Kingdom    
Level/Table2 
              Kingdom, NumberOfExtremities    
Level/Table3 
              ExtremityName, NumberOfFingers

示例数据集

1 霍默·辛普森、1 拉尔夫·威格姆、2 乔恩 双向飞碟、3 原子蚁、2 尸罗(蜘蛛)

查询..“手指数量”

数量 = 1*4*4 + 1*4*4 + 1*4*5 + 3*6*1 + 2*6*1 = 82个手指(让乔恩成为一个人)


我想知道是否有任何工具可以定义它可解析以自动创建继承数据,并绘制这种树,(如果可能的话,可以进行这种数据访问。)

它可以使用 FreeMind 等手动绘制,但据我所知,它不允许您自动定义数据类型或结构< /strong> 创建项目的继承分支,因此必须通过复制来重复和重复结构(并且存在错误的风险),这确实很烦人。对重复数据进行重复工作(人类运行重复代码),这是一个有缺陷的功能。

所以我想用正确的语言编写数据,以便我重用它 对于查询和可视化,如果所有数据都在 XML、Java 类或数据库文件等中。是否有一些工具可以查看树并进行查询?

PD:我希望在文件系统中创建嵌套文件夹并在树视图中使用 Norton Commander 不是一个选项(只是因为它必须手动构建)

Simple and common tree like data structures

Data Structure example

Animated Cartoons have 4 extremities (arm, leg,limb..)
Human have 4 ext.
Insects have 6 ext.
Arachnids have 6 ext.

Animated Cartoons have 4 by extremity
Human have 5 by ext.
Insects have 1 by ext.
Arachnids have 1 by ext.

Some Kind of Implementation

Level/Table0 
              Quantity, Item
Level/Table1
              ItemName, Kingdom    
Level/Table2 
              Kingdom, NumberOfExtremities    
Level/Table3 
              ExtremityName, NumberOfFingers

Example Dataset

1 Homer Simpson, 1 Ralph Wiggum, 2 jon
skeet, 3 Atomic ant, 2 Shelob (spider)

Querying.. "Number of fingers"

Number = 1*4*4 + 1*4*4 + 1*4*5 + 3*6*1 + 2*6*1 = 82 fingers (Let Jon be a Human)


I wonder if there is any tool for define it parseable for automatic create the inherited data, and drawing this kind of trees, (with the plus of making this kind of data access, if where posible..)

It could be drawn manually with for example FreeMind, but AFAIK it dont let you define datatype or structures to automatically create inherited branch of items, so it's really annoying to have to repeat and repeat a structure by copying (and with the risk of mistake). Repeated Work over Repeated Data, (an human running repeated code), it's a buggy feature.

So I would like to write the data in the correct language that let me reuse it
for queries and visualization, if all data is in XML, or Java Classes, or in a Database File, etc.. there is some tool for viewing the tree and making the query?

PD : Creating nested folders in a filesystem and using Norton Commander in tree view, is not an option, I hope (just because It have to be builded manually)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情丝乱 2024-09-24 06:06:08

您的答案主要取决于您已经拥有哪些编程技能以及您愿意获得哪些技能。我可以告诉你我会用我所知道的做什么。

我认为要绘制树木,您需要一个 LaTeX 包,例如 qtree< /a>.如果你不喜欢这个,还有很多其他的。你必须用你最喜欢的脚本语言编写一个脚本来将你的输入解析到 LaTeX 代码中以生成树,但是如果我正确理解你的意图,在大多数语言中这可以轻松地用不到 100 行来完成。我绝对建议使用 Ruby 的 REXML,或任何您最喜欢的脚本语言。

如果您希望生成更多交互式树,请查看 Adobe Flex 框架。再说一遍,如果您不喜欢这个特定的框架,还有很多其他框架(我推荐博客 FlowingData )。

希望这对您有所帮助,并且我没有严重误解您的问题。

Your answer is mostly going to depend on what programming skills you already have and what skills you are willing to acquire. I can tell you what I would do with what I know.

I think for drawing trees you want a LaTeX package like qtree. If you don't like this one, there are a bunch of others out there. You'd have to write a script in whatever your favorite scripting language is to parse your input into the LaTeX code to generate the trees, but this could easily be done with less than 100 lines in most languages, if I properly understand your intentions. I would definitely recommend storing your data in an XML format using a library like Ruby's REXML, or whatever your favorite scripting language has.

If you are looking to generate more interactive trees, check out the Adobe Flex Framework. Again, if you don't like this specific framework, there are bunches of others out there (I recommend the blog FlowingData).

Hope this helps and I didn't miserably misunderstand your question.

ι不睡觉的鱼゛ 2024-09-24 06:06:08

您所描述的数据结构看起来适合 xml 格式。看看Exist XML 数据库,如果我可以这么说的话,它是最完整的XML 数据库。它附带了许多工具,可帮助您快速入门!就像管理 http 界面中的 XQuery Sandbox 选项一样。

示例数据集
1 霍默·辛普森、1 拉尔夫·威古姆、2 琼恩双向飞碟、3 原子蚁、2 尸罗(蜘蛛)

我假设有 2 个 jon skeet 实例、3 个 Atomic ant 实例code> 和 2 个 Shelob 实例

下面是一个 XQuery 示例:

let $doc := 
<root>
    <definition>
        <AnimatedCartoons>
            <extremities>4</extremities>
            <fingers_per_ext>4</fingers_per_ext>
        </AnimatedCartoons>
        <Human>
            <extremities>4</extremities>
            <fingers_per_ext>5</fingers_per_ext>
        </Human>
        <Insects>
            <extremities>6</extremities>
            <fingers_per_ext>1</fingers_per_ext>
        </Insects>
        <Arachnids>
            <extremities>6</extremities>
            <fingers_per_ext>1</fingers_per_ext>
        </Arachnids>
    </definition>

    <subject><name>Homer Simpson</name><kind>AnimatedCartoons</kind></subject>
    <subject><name>Ralph Wiggum</name><kind>AnimatedCartoons</kind></subject>
    <subject><name>jon skeet</name><kind>Human</kind></subject>
    <subject><name>jon skeet</name><kind>Human</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Shelob</name><kind>Arachnids</kind></subject>
    <subject><name>Shelob</name><kind>Arachnids</kind></subject>
</root>
let $definitions := $doc/definition/*
let $subjects := $doc/subject

(: here goes some query logic :)
let $fingers := fn:sum( 
    for $subject in $subjects
    return (
        for $x in $definitions
        where fn:name($x) = $subject/kind
        return $x/extremities * $x/fingers_per_ext
        )
    )
return $fingers

Data structure that You are describing looks like it can fit in xml format. Take a look at Exist XML database, and if I can say so it is the most complete xml database. It comes with many tools to get you started fast ! like XQuery Sandbox option in admin http interface.

Example Dataset
1 Homer Simpson, 1 Ralph Wiggum, 2 jon skeet, 3 Atomic ant, 2 Shelob (spider)

I am assuming that there are 2 instances of jon skeet, 3 instances of Atomic ant and 2 instances of Shelob

Here is a XQuery example:

let $doc := 
<root>
    <definition>
        <AnimatedCartoons>
            <extremities>4</extremities>
            <fingers_per_ext>4</fingers_per_ext>
        </AnimatedCartoons>
        <Human>
            <extremities>4</extremities>
            <fingers_per_ext>5</fingers_per_ext>
        </Human>
        <Insects>
            <extremities>6</extremities>
            <fingers_per_ext>1</fingers_per_ext>
        </Insects>
        <Arachnids>
            <extremities>6</extremities>
            <fingers_per_ext>1</fingers_per_ext>
        </Arachnids>
    </definition>

    <subject><name>Homer Simpson</name><kind>AnimatedCartoons</kind></subject>
    <subject><name>Ralph Wiggum</name><kind>AnimatedCartoons</kind></subject>
    <subject><name>jon skeet</name><kind>Human</kind></subject>
    <subject><name>jon skeet</name><kind>Human</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Atomic ant</name><kind>Insects</kind></subject>
    <subject><name>Shelob</name><kind>Arachnids</kind></subject>
    <subject><name>Shelob</name><kind>Arachnids</kind></subject>
</root>
let $definitions := $doc/definition/*
let $subjects := $doc/subject

(: here goes some query logic :)
let $fingers := fn:sum( 
    for $subject in $subjects
    return (
        for $x in $definitions
        where fn:name($x) = $subject/kind
        return $x/extremities * $x/fingers_per_ext
        )
    )
return $fingers
小苏打饼 2024-09-24 06:06:08

具有可视化功能的 XML 模式编辑器可能是我正在寻找的

http://en.wikipedia.org/wiki/ XML_Schema_Editor

检查它..

XML Schema Editor with visualization is perhaps what I am searching for

http://en.wikipedia.org/wiki/XML_Schema_Editor

checking it..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文