def showResourceTypesDialog(self): #save the resource to create it if it doesn't exist yet if not self.resource: self.save() dialog = TypeChooserDialog(mainWindow=self.mainWindow, typesUris=self.resource.types()) if dialog.exec_(): chosenTypes = dialog.chosenTypes() types = [] for type in chosenTypes: types.append(type.resourceUri()) self.resource.setTypes(types) self.ui.updateFields()
def updateRangeType(self): #save the resource to create it if it doesn't exist yet if not self.resource: self.save() rangeUrl = QUrl(self.resource.property(Soprano.Vocabulary.RDFS.range()).toString()) #TODO: only one type should be possible (check) dialog = TypeChooserDialog(mainWindow=self.mainWindow, typesUris=[rangeUrl]) if dialog.exec_(): chosenTypes = dialog.chosenTypes() if len(chosenTypes) == 1: self.setCursor(Qt.WaitCursor) range = chosenTypes[0] self.resource.setProperty(Soprano.Vocabulary.RDFS.range(), Nepomuk.Variant(range.resourceUri())) self.ui.updateFields() self.unsetCursor()
def updateDomain(self): #save the resource to create it if it doesn't exist yet if not self.resource: self.save() domainUrl = QUrl(self.resource.property(Soprano.Vocabulary.RDFS.domain()).toString()) dialog = TypeChooserDialog(mainWindow=self.mainWindow, typesUris=[domainUrl]) if dialog.exec_(): chosenTypes = dialog.chosenTypes() if len(chosenTypes) == 1: self.setCursor(Qt.WaitCursor) domain = chosenTypes[0] self.resource.setProperty(Soprano.Vocabulary.RDFS.domain(), Nepomuk.Variant(domain.resourceUri())) self.ui.updateFields() self.unsetCursor()
def updateRangeType(self): #save the resource to create it if it doesn't exist yet if not self.resource: self.save() rangeUrl = QUrl( self.resource.property(Soprano.Vocabulary.RDFS.range()).toString()) #TODO: only one type should be possible (check) dialog = TypeChooserDialog(mainWindow=self.mainWindow, typesUris=[rangeUrl]) if dialog.exec_(): chosenTypes = dialog.chosenTypes() if len(chosenTypes) == 1: self.setCursor(Qt.WaitCursor) range = chosenTypes[0] self.resource.setProperty(Soprano.Vocabulary.RDFS.range(), Nepomuk.Variant(range.resourceUri())) self.ui.updateFields() self.unsetCursor()
def updateDomain(self): #save the resource to create it if it doesn't exist yet if not self.resource: self.save() domainUrl = QUrl( self.resource.property( Soprano.Vocabulary.RDFS.domain()).toString()) dialog = TypeChooserDialog(mainWindow=self.mainWindow, typesUris=[domainUrl]) if dialog.exec_(): chosenTypes = dialog.chosenTypes() if len(chosenTypes) == 1: self.setCursor(Qt.WaitCursor) domain = chosenTypes[0] self.resource.setProperty( Soprano.Vocabulary.RDFS.domain(), Nepomuk.Variant(domain.resourceUri())) self.ui.updateFields() self.unsetCursor()