使用 ROWLEX API 查找类的 owlSubClass?
我有一个给定的本体论,我喜欢根据它进行推理。我使用适用于 .NET 的 ROWLEX API。
如何找到一个类的所有 owlSubClass?
I have a given ontology, on which I like to reason. I use the ROWLEX API for .NET.
How can I find all owlSubClasses of a class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ROWLEX 不是推理机。它实现了推理器的一些功能 - 这对于 C# 类生成非常必要 - 但它的 API 并不是为此而设计的。然而,仍然有希望,只是不是最优雅的解决方案。
我假设您有一个本体,并使用 OwlGrinder.exe 从中生成了 .NET 类。因此,默认情况下,您会为本体中的每个相应 OWL 类生成两个关联的 .NET 类:一个轻型类和一个完整类。我们将仅使用轻量级。我们只需迭代所有 .NET 类并过滤掉是否是子类。就是这样。
我没有尝试该代码,它可能有错误。但它确实表明了这个想法。每个生成的类都添加了一堆属性。其中包括 SubClassOfAttribute 中的基类以及它们是轻量类还是使用 LightVersionAttribute 的完整类。您可以根据这些属性过滤出您感兴趣的类。
ROWLEX is not a reasoner. It has some functionality of a reasoner implemented - it is very necessary for the C# class generation - but its API is not designed for that. However, there is still hope, just not the most elegant solution.
I assume, that you have an ontology and you generated .NET classes from that using OwlGrinder.exe. Therefore by default, you have two associated .NET classes generated for each corresponding OWL class in the ontology: one light class and one full class. We are going to use the light classes only. We simply iterate through ALL .NET classes and filter out if is a subclass. That is it.
I did not try the code, it may be buggy. But it does show the idea. Each generated class have a bunch of attributes added. These include their base classes in the SubClassOfAttribute and whether they are light classes or full classes using the LightVersionAttribute. You can filter out the classes you are interested in based on these attributes.