def insert(self,
               entity_id,
               property_uri,
               value):
        """Method inserts a new entity's property in Fedora4 Repository

        Args:
            entity_id(string): Unique ID of Fedora object
            property_uri(string): URI of property
            value: Value of the property, can be literal or URI reference

        Returns:
            boolean: True if successful changed in Fedora, False otherwise
        """
        if not entity_id.startswith("http"):
            entity_uri = urllib.parse.urljoin(self.base_url, entity_id)
        else:
            entity_uri = entity_id
        if entity_uri.endswith("/"):
            entity_uri = entity_uri[:-1]
        if not entity_id.endswith("fcr:metadata"):
            entity_uri = "/".join([entity_uri, "fcr:metadata"])
        if not self.exists(entity_id):
            self.create(entity_id)
        sparql_template = Template("""$prefix
        INSERT DATA {
             <$entity> $prop_uri $value_str ;
        }""")
        sparql = sparql_template.substitute(
            prefix=build_prefixes(self.namespaces),
            entity=entity_uri,
            prop_uri=property_uri,
            value_str=self.__value_format__(value))
        update_request = urllib.request.Request(
            entity_uri,
            data=sparql.encode(),
            method='PATCH',
            headers={'Content-Type': 'application/sparql-update'})
        try:
            response = urllib.request.urlopen(update_request)
        except urllib.error.HTTPError:
            print("Error trying patch {}, sparql=\n{}".format(entity_uri,
                sparql))
            return False
        if response.code < 400:
            return True
        return False
def insert ( self , entity_id , property_uri , value ) : if not entity_id . startswith ( "http" ) : entity_uri = urllib . parse . urljoin ( self . base_url , entity_id ) else : entity_uri = entity_id if entity_uri . endswith ( "/" ) : entity_uri = entity_uri [ : - 1 ] if not entity_id . endswith ( "fcr:metadata" ) : entity_uri = "/" . join ( [ entity_uri , "fcr:metadata" ] ) if not self . exists ( entity_id ) : self . create ( entity_id ) sparql_template = Template ( """$prefix
        INSERT DATA {
             <$entity> $prop_uri $value_str ;
        }""" ) sparql = sparql_template . substitute ( prefix = build_prefixes ( self . namespaces ) , entity = entity_uri , prop_uri = property_uri , value_str = self . __value_format__ ( value ) ) update_request = urllib . request . Request ( entity_uri , data = sparql . encode ( ) , method = 'PATCH' , headers = { 'Content-Type' : 'application/sparql-update' } ) try : response = urllib . request . urlopen ( update_request ) except urllib . error . HTTPError : print ( "Error trying patch {}, sparql=\n{}" . format ( entity_uri , sparql ) ) return False if response . code < 400 : return True return False
Method inserts a new entity's property in Fedora4 Repository

        Args:
            entity_id(string): Unique ID of Fedora object
            property_uri(string): URI of property
            value: Value of the property, can be literal or URI reference

        Returns:
            boolean: True if successful changed in Fedora, False otherwise