예제 #1
0
 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()
예제 #2
0
    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()
예제 #3
0
    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()
예제 #4
0
    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()
예제 #5
0
    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()