Skip to content

Instantly share code, notes, and snippets.

@abroniewski
Created May 20, 2022 12:04
Show Gist options
  • Save abroniewski/1bdd29cd9b1dbcedf6fc4cc3d11e6c33 to your computer and use it in GitHub Desktop.
Save abroniewski/1bdd29cd9b1dbcedf6fc4cc3d11e6c33 to your computer and use it in GitHub Desktop.
Here we created a superClass "Person" so that we only have to assign a single property called name ot "Person" instead of a seperate property for each class.
graph.add((KG.Person, RDF.type, RDFS.Class))
graph.add((KG.Person, RDFS.label, Literal("Person")))
graph.add((KG.Author, RDFS.subClassOf, KG.Person))
graph.add((KG.Author, RDFS.label, Literal("Author")))
graph.add((KG.Reviewer, RDFS.subClassOf, KG.Person))
graph.add((KG.Reviewer, RDFS.label, Literal("Reviewer")))
graph.add((KG.Chair, RDFS.subClassOf, KG.Person))
graph.add((KG.Chair, RDFS.label, Literal("Chair")))
graph.add((KG.Editor, RDFS.subClassOf, KG.Person))
graph.add((KG.Editor, RDFS.label, Literal("Editor")))
#We made all of the different types of people a subClassOf :Person so that we could associate the property :name
# with only a single class instead of repeating it like we did with the SubjectArea
graph.add((KG.name, RDF.type, RDF.Property))
graph.add((KG.name, RDFS.domain, KG.Person))
graph.add((KG.name, RDFS.range, XSD.string))
graph.add((KG.name, RDFS.label, Literal("name")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment