Пример #1
0
    def setInverses(self):
        RDFGraph.setSynonyms(
            self, OWL.sameAs,
            [str(SKOS.related), str(SKOS.broaderTransitive)])

        for s, p, o in self.g.triples((None, SKOS.related, None)):
            self.g.add((o, SKOS.related, s))

        for s, p, o in self.g.triples((None, SKOS.broaderTransitive, None)):
            self.g.add((o, SKOS.narrowerTransitive, s))
Пример #2
0
	def setInverses(self):
		RDFGraph.setSynonyms(self,LEXINFO.synonym,[str(LEXINFO.hypernym),str(LEXINFO.relatedTerm),str(LEXINFO.antonym)])

		for s,p,o in self.g.triples( (None, LEXINFO.antonym, None) ):
			self.g.add((o,LEXINFO.antonym,s))

		for s,p,o in self.g.triples( (None, LEXINFO.relatedTerm, None) ):
			self.g.add((o,LEXINFO.relatedTerm,s))

		for s,p,o in self.g.triples( (None, LEXINFO.hypernym, None) ):
			self.g.add((o,LEXINFO.hyponym,s))
Пример #3
0
	def __init__(self,exportconfig,language,format,buildpackage,persist):
		RDFGraph.__init__(self,exportconfig,language,format,buildpackage,persist)

		self.g.bind("ontolex", ONTOLEX)
		self.g.bind("lexinfo", LEXINFO)
		self.g.bind("decomp", DECOMP)
		self.g.bind("isocat", ISOCAT)

		if self.buildpackage:
			self.g.bind("lime", LIME)
			self.g.add((URIRef("urn:" + exportconfig["name"]),RDF.type,LIME.lexicon))
			self.g.add((URIRef("urn:" + exportconfig["name"]),LIME.language,URIRef("http://id.loc.gov/vocabulary/iso639-1/" + language)))
Пример #4
0
    def __init__(self, exportconfig, language, buildpackage, persist):
        RDFGraph.__init__(self, exportconfig, language, "turtle", buildpackage,
                          persist)

        self.g.bind("skos", SKOS)
        self.g.bind("owl", OWL)

        if self.buildpackage:
            self.g.add((URIRef("urn:" + exportconfig["name"]), RDF.type,
                        SKOS.ConceptScheme))
            self.g.add(
                (URIRef("urn:" + exportconfig["name"]), DCTERMS.language,
                 URIRef("http://id.loc.gov/vocabulary/iso639-1/" + language)))
Пример #5
0
	def setRedundants(self):
		""" Not setting inverse relations, so if you want those, execute this before setInverses. """
		RDFGraph.setRedundants(self)

		for s,p,o in self.g.triples( (None, ONTOLEX.canonicalForm, None) ):
			self.g.add((s,ONTOLEX.lexicalForm,o))

		for s,p,o in self.g.triples( (None, ONTOLEX.otherForm, None) ):
			self.g.add((s,ONTOLEX.lexicalForm,o))

		for s,p,o in self.g.triples( (None, ONTOLEX.writtenRep, None) ):
			self.g.add((s,RDFS.label,o))

		for s,p,o in self.g.triples( (None, LEXINFO.acronymFor, None) ):
			self.g.add((s,LEXINFO.contractionFor,o))
			self.g.add((s,RDF.type,LEXINFO.contraction))

		for s,p,o in self.g.triples( (None, LEXINFO.initialismFor, None) ):
			self.g.add((s,LEXINFO.contractionFor,o))
			self.g.add((s,RDF.type,LEXINFO.contraction))

		for s,p,o in self.g.triples( (None, LEXINFO.abbreviationFor, None) ):
			self.g.add((s,LEXINFO.contractionFor,o))
			self.g.add((s,RDF.type,LEXINFO.contraction))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.presentParticipleAdjective) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.adjective))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.pastParticipleAdjective) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.adjective))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.ordinalAdjective) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.adjective))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.cardinalNumeral) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.numeral))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.indefiniteCardinalNumeral) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.numeral))

		for s,p,o in self.g.triples( (None,LEXINFO.partOfSpeech,LEXINFO.indefiniteOrdinalNumeral) ):
			self.g.add((s,LEXINFO.partOfSpeech,LEXINFO.numeral))
Пример #6
0
	def setTransitives(self):
		RDFGraph.setTransitives(self,LEXINFO.relatedTerm)
Пример #7
0
 def setTransitives(self):
     RDFGraph.setTransitives(self, SKOS.related)