Comments (2)
@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.
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)
- How to add java exe path to google colab
- Access domain and range of an object property inferred by reasoner from an inverse property
- Encountering "TypeError: 'NoneType' object is not subscriptable" while saving an ontology (onto.save()) HOT 2
- duplicate file in owlready2 0.38 "driver (copie 1).py" HOT 1
- Test in _is_valid_language_code(s) is not complete
- Can not parse Chebi ontology files?
- Crashing trying to get INDIRECT_get_classes_properties() of entities with Inverse relations
- TypeError: '<' not supported between instances of 'str' and 'int'
- `.min` does not return expected values for cardinality >1
- Issue using .label with rdfs:label, but functions with rdf:label HOT 1
- Conda installation
- Setting error_on_undefined_entities=False
- "AttributeError: 'SubGraph' object has no attribute 'create_parse_func'" when installing PyMedTermino2 HOT 1
- read custom datatypes owlready2
- Loading ontology issue
- Creating SWRL rule using imported ontology
- Can Domain and Range be retrieved for SNOMED-CT relationships?
- Issue with SWRL Rules and Data Property Inference HOT 4
- Mailing list/forum offline
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from owlready2.