Previous topic

Character Converter

Next topic

Store

This Page

Graph Manager

This module is used to interact with a set of merged RDF/OWL graphs.

class eltk.utils.GraphManager.GraphManager(graphs)

GraphManager takes a list of RDF and OWL files, merges them, and provides convenience methods for extracting data from the (combined) graph. Note: It contains GOLD specific funtion calls. Also, when the documentation refers to ‘object’ this should be interpreted by the user as the object node within the graph (subject predicate object) entity relations and not ‘object’ in the sense of OOP. Also, the term ‘subject’ should be considered the ‘subject’ node.

getAddress(subject)

Return a list of subjects that match rdf:type bibtex:hasAddress

Parameter:subject (str) – a URI
Return type:list
getArticles()

Return a list of subjects that match rdf:type bibtex:Article

Return type:list
getAuthorList(subject)

Return a list of subjects that match rdf:type biblio:hasAuthorList

Parameter:subject (str) – a URI
Return type:list
getAuthors(subject)

Return a list of authors that match the subject and biblio:hasAuthorList, e.g.:

  • s: rdf:about=”http://www.linguistics-ontology.org/bibliography/gold-bibliography.rdf#Leman1980”
  • p: biblio:hasAuthorList
Parameter:subject (str) – a URI
Return type:list
getBibtexPublicationType()

Returns a list of rdflib.Literal.Literal objects

Return type:list
getBookTitle(subject)

Return a list of subjects that match rdf:type bibtex:hasBookTitle

Parameter:subject (str) – a URI
Return type:list
getBooks()

Return a list of subjects that match rdf:type bibtex:Book

Return type:list
getChapter(subject)

Return a list of subjects that match rdf:type bibtex:hasChapter

Parameter:subject (str) – a URI
Return type:list
getCitations(subject)

Return a list of objects where the subject parameter matches the biblio[“hasCitation”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexAddress(subject)

Return a list of objects where the subject parameter matches the biblio[“hasAddress”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexAuthors(subject)

Get object matches of a graph given a tuple (subject, biblio:hasAuthorList). The subject passed it needs to be a string and not a rdflib.URI object.

Parameter:subject (str) – subject passed it needs to be a string and not a rdflib.URI object
Return type:list
getCitationsBibtexComment(subject)

Return a list of objects where the subject parameter matches the rdfs[“comment”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexEditors(subject)

Return a list of objects where the subject parameter matches the biblio[“hasEditorList”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexEntry(subject)

Return a list of objects where the subject parameter matches the biblio[“hasEntry”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexJournal(subject)

Return a list of objects where the subject parameter matches the biblio[“hasJournal”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexPublicationYear(subject)

Get object matches of a graph given a tuple (subject, biblio:hasBookTitle). The subject passed it needs to be a string and not a rdflib.URI object.

Parameter:subject (str) – subject passed it needs to be a string and not a rdflib.URI object
Return type:list
getCitationsBibtexPublisher(subject)

Return a list of objects where the subject parameter matches the biblio[“hasPublisher”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexSeries(subject)

Return a list of objects where the subject parameter matches the biblio[“hasSeries”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsBibtexTitle(subject)

Get object matches of a graph given a tuple (subject, biblio:hasBookTitle). The subject passed it needs to be a string and not a rdflib.URI object.

Parameter:subject (str) – subject passed it needs to be a string and not a rdflib.URI object
Return type:list
getCitationsBibtexVolume(subject)

Return a list of objects where the subject parameter matches the biblio[“hasVolume”] predicate

Parameter:subject (str) – a URI
Return type:list
getCitationsPages(subject)

Return a list of objects where the subject parameter matches the biblio[“hasPageInformation”] predicate

Parameter:subject (str) – a URI
Return type:list
getClasses()

Returns all subjects that match rdfs:type predicates and owl:Class objects. Returns a list of type rdflib.Literal.Literal.

Return type:list
Returns:a list of rdflib.URIRef.URIRef objects
getDescription(subject)

Gets each class’ rdfs:comment. Takes a list of subjects. Returns a list of lists of rdflib.Literals, which are of type list, e.g. [rdflib.Literal(‘Verbalizer is the class of category changing units that change nouns into verbs.’, language=None, datatype=None)]. Print on an rdflib.Literal prints the URI.

Parameter:subject (str) – a URI
Return type:list
getDescriptions(l)

Gets each class’ rdfs:comment. Takes a list of subjects. Returns a list of lists of rdflib.Literals, which are of type list, e.g. [rdflib.Literal(‘Verbalizer is the class of category changing units that change nouns into verbs.’, language=None, datatype=None)]

Parameter:l (list) – a list of subject nodes
Return type:list
getEditorList(subject)

Return a list of subjects that match rdf:type biblio:hasEditorList

Parameter:subject (str) – a URI
Return type:list
getInCollections()

Return a list of subjects that match rdf:type bibtex:InCollection

Return type:list
getInProceedings()

Return a list of subjects that match rdf:type bibtex:InProceedings

Return type:list
getJournal(subject)

Return a list of subjects that match rdf:type bibtex:hasJournal

Parameter:subject (str) – a URI
Return type:list
getLabel(subject)

Return a list of objects where the subject parameter matches the rdfs[“label”] predicate

Parameter:subject (str) – a URI
Return type:list
getLabels(l)

Return a list of objects where the subject parameter matches the rdfs[“label”] predicate

Parameter:l (list) – a list of subject (strs) as URIs
Return type:list
getLength()

Return length of (merged) graph(s).

Return type:int
Returns:length of the graph
getMiscs()

Return a list of subjects that match rdf:type bibtex:Misc

Return type:list
getPages(subject)

Return a list of subjects that match rdf:type bibtex:hasPages

Parameter:subject (str) – a URI
Return type:list
getPhdTheses()

Return a list of subjects that match rdf:type bibtex:PhDThesis

Return type:list
getPredicateObjects(subject)

Return a list of predicate and object tuples for a given subject

Parameter:subject (str) – a URI
Return type:list
Returns:a list of predicate and object tuples that match the
getPublisher(subject)

Return a list of subjects that match rdf:type bibtex:hasPublisher

Parameter:subject (str) – a URI
Return type:list
getSeq(subject)

Returns a sequence of objects that match the subject parameter and rdf:_1

Parameter:subject (str) – a URI
Return type:list
getSeqs(bnode)

Return a list of predicates_object tuples that have a bnode

Parameter:bnode (str) – a URI
Return type:list
getSubClasses(subject)

Returns a list of rdflib.URIRef objects that contains the subClassOf relations for the passed in subject.

Parameter:subject (str) – a URI
Return type:list
getSubjectObjects(predicate)

Returns a list of (subject, object) tuples for the given predicate. The predicate may be passed as either a uri or as a tuple of (uri_prefix, concept).

Parameter:predicate (str) – a URI
Return type:list
getTechReports()

Return a list of subjects that match rdf:type bibtex:TechReport

Return type:list
getTitle(subject)

Return a list of subjects that match rdf:type bibtex:Title

Parameter:subject (str) – a URI
Return type:list
getVolume(subject)

Return a list of subjects that match rdf:type bibtex:hasVolume

Parameter:subject (str) – a URI
Return type:list
getYear(subject)

Return a list of subjects that match rdf:type bibtex:hasYear

Parameter:subject (str) – a URI
Return type:list
isDefinedBy()

Returns a list of of (rdflib.URIRef, rdflib.URIRef) tuples for (subject, object) defined by the predicate rdfs:isDefinedBy.

Return type:list
printGraph()
Print the graph