Giter Site home page Giter Site logo

Comments (2)

B-Gendron avatar B-Gendron commented on July 27, 2024 1

@tommycarstensen I got the exact same problem when I try to apply an object property to an individual. The funny thing is that it works perfectly for data properties but not for object properties. I finally figured out what happened and I think it might be useful for others that would encouter this problem. The error I made is that I forgot to declare the class of the object to be used as the object property output. Formally, instead of assigning a token to an utterance like this:

token = dialog_dict['TokenID'][current_token_index:current_token_index+n_tokens][0]
utt.containsToken = [token]

I declare that token is of class Token by adding an intermediate step, which gives:

token = dialog_dict['TokenID'][current_token_index:current_token_index+n_tokens][0]
tok = onto.Token(token)
utt.containsToken = [tok]

Now, the assignation works perfectly.

from owlready2.

Hannah-Doerpholz avatar Hannah-Doerpholz commented on July 27, 2024

Not a dev here, but I think I can help you out. The problem is with the IRI. You are loading an OBO ontology. When you check out the original ontology file you will find that the class BTO_0000042 can only be accessed through http://purl.obolibrary.org/obo/BTO_0000042. However, when you print the variable onto you get http://purl.obolibrary.org/obo/bto.owl#. If you attach the class id after that, there will naturally be an error. You have to properly define the obo namespace as instructed in the "namspaces" section in the documentation. The following should work for you:

onto = get_ontology('http://purl.obolibrary.org/obo/bto.owl')
obo = get_namespace('http://purl.obolibrary.org/obo/')
print(onto.search(subclass_of = obo.BTO_0000042))

I hope I could help with your problem (if it is still relevant for you).

from owlready2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.