Select single class and all of its properties as a subset #2111
Unanswered
davidshumway
asked this question in
Q&A
Replies: 1 comment 3 replies
-
@davidshumway it is a bit unclear what exactly you want, but possibly you could use g.triples((None, RDF.type, URIRef(http://purl.obolibrary.org/obo/IDO_0000406))) If you can provide a complete graph, and exact results you want, it would be easier. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a method in rdflib to extract a single class and all of its associated properties, for example, if one had a list of classes they wanted to add to another ontology (i.e.
Graph()
)?For example, consider the following class from IDO: http://purl.obolibrary.org/obo/IDO_0000406 (see below). In this example, it might be easier to simply parse the contents of the ontology's OWL file using a regex pattern such as
/(<owl:Class .+?\s\s\s\s\n<\/owl:Class>/
to capture all of the classes, after which the classes of interest could simply be filtered out and appended to a new OWL file.Loading the ontology as a new
Graph()
and iterating through all of the statements seems like a tough way to go because e.g. in this case there are a number of<owl:Restriction>
,<owl:intersectionOf>
, etc. statements which end up as anonymous classes.Beta Was this translation helpful? Give feedback.
All reactions