美文网首页
owlready2的简单介绍

owlready2的简单介绍

作者: 一一的试验田 | 来源:发表于2019-05-14 20:14 被阅读0次

1. Introduction

Owlready2 is a package for manipulating OWL 2.0 ontologies in Python. It can load, modify, save ontologies, and it supports reasoning via HermiT (included). Owlready allows a transparent access to OWL ontologies.

2. Owlready2 can:

Import ontologies in RDF/XML, OWL/XML or NTriples format.

Manipulates ontology classes, instances and annotations as if they were Python objects.

Add Python methods to ontology classes.

Re-classify instances automatically, using the HermiT reasoner.

Import medical terminologies from UMLS (see PyMedTermino2).

3. instance

from owlready2 import *

onto_path.append("/Users/a-pc/Documents/智齿科技/知识图谱")

onto = get_ontology("http://www.lesfleursdunormal.fr/static/_downloads/pizza_onto.owl")

onto.load()

get_ontology("http://www.lesfleursdunormal.fr/static/_downloads/pizza_onto.owl#")

# Create new classes in the ontology, possibly mixing OWL constructs and Python methods:

class NonVegetarianPizza(onto.Pizza):

    equivalent_to = [

        onto.Pizza

        & ( onto.has_topping.some(onto.MeatTopping)

        | onto.has_topping.some(onto.FishTopping)

        ) ]

def eat(self): print("Beurk! I'm vegetarian!")# Create new classes in the ontology, possibly mixing OWL constructs and Python methods:

class NonVegetarianPizza(onto.Pizza):

    equivalent_to = [

        onto.Pizza

        & ( onto.has_topping.some(onto.MeatTopping)

        | onto.has_topping.some(onto.FishTopping)

        ) ]

def eat(self): print("Beurk! I'm vegetarian!")

# Access the classes of the ontology, and create new instances / individuals:

test_pizza = onto.Pizza("test_pizza_owl_identifier")

test_pizza.has_topping = [ onto.CheeseTopping(), onto.TomatoTopping() ]

test_pizza.has_topping.append(onto.MeatTopping())

# Execute HermiT and reparent instances and classessync_reasoner()

test_pizza.__class__

pizza_onto.NonVegetarianPizza

test_pizza.eat()

Beurk! I'm vegetarian!

相关文章

  • owlready2的简单介绍

    1. Introduction Owlready2 is a package for manipulating O...

  • 简单的介绍

    我,就是我。一个简简单单,平平凡凡,普通的不能再普通的地球人。生活在一座每天被雾霾笼罩的重工业城市。每天过着两点一...

  • 简单的介绍

    大家好,我是一名大学生,仍在校学习会计专业,即将毕业。 非常高兴能在这里与大家相见,碰撞灵魂。 我是一个内心敏感时...

  • 简单问题的简单介绍

    其实这东西早该写了,由于我懒,秉着能拖一天是一天的重要精神,我觉得我能很完美地拖完这一年半。 但还是得写,因为与其...

  • 简单介绍

    【姓名】龙行 【城市】贵州人在北京 【职业】仪器开发 【标签】学习者 【公众号】暂无 【爱好】看书、深度思考、旅游...

  • 简单介绍

    这里momo 坐标古都 新手上路,多指教 会发一些日常或者自编的微故事 一般都是恐怖类型吧…… 不喜勿喷,毕竟刚入圈

  • 简单介绍

    第一次打开简书,我就把它当成我的日记本了,呵呵…就记录我和我的两个女儿的点点滴滴,陪伴他们,和她们一起成长。...

  • 简单介绍

    hadoop是什么 hadoop是一个由Apache基金会所开发的分布式系统基础框架 hadoop实现了一个分布式...

  • 简单介绍

    Hello 这里是一位对文字如痴如醉爱着的人。喜欢阅读,资历尚浅,学识浅薄,还请关照。 以后会不定期更文。 期待每一天。

  • 简单介绍

    91年生 大专专业是英语教育 本科专业是教育学 2009年下半年认识了现在的老公,2011年毕业后没有按常规考编制...

网友评论

      本文标题:owlready2的简单介绍

      本文链接:https://www.haomeiwen.com/subject/xkaeaqtx.html