@@ -520,7 +520,7 @@ def add_to_graph(self) -> str:
520520 }}"""
521521
522522 query_remove_label = f"""
523- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
523+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
524524 DELETE {{
525525 GRAPH <{ self .shapes_graph_iri } > {{
526526 <{ self .shapes_graph_iri } > rdfs:label ?label
@@ -533,22 +533,22 @@ def add_to_graph(self) -> str:
533533 }}
534534 }}"""
535535
536- has_label = json .loads (post_sparql (query = query_ask_label )).get ("boolean" , False )
537- if self .label and has_label :
538- post_update (query = query_remove_label )
539- if self .label or not has_label :
540- self .create_label ()
541-
542536 query_data = f"""
543537 INSERT DATA {{
544538 GRAPH <{ self .shapes_graph_iri } > {{
545539 { self .shapes_graph .serialize (format = "nt" , encoding = "utf-8" ).decode ()}
546540 }}
547541 }}"""
548542
543+ has_label = json .loads (post_sparql (query = query_ask_label )).get ("boolean" , False )
544+ if self .label and has_label :
545+ post_update (query = query_remove_label )
546+ if self .label or not has_label :
547+ self .create_label ()
549548 post_update (query_data )
550-
549+ setup_cmempy_user_access ( self . context . user )
551550 now = datetime .now (UTC ).isoformat (timespec = "milliseconds" )[:- 6 ] + "Z"
551+
552552 query_remove_modified = f"""
553553 PREFIX dcterms: <http://purl.org/dc/terms/>
554554 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
@@ -566,9 +566,6 @@ def add_to_graph(self) -> str:
566566 }}
567567 }}"""
568568
569- setup_cmempy_user_access (self .context .user )
570- post_update (query_remove_modified )
571-
572569 query_add_modified = f"""
573570 PREFIX dcterms: <http://purl.org/dc/terms/>
574571 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
@@ -585,6 +582,7 @@ def add_to_graph(self) -> str:
585582 BIND(IF(!BOUND(?datetime), xsd:dateTime("{ now } "), ?undef) AS ?current)
586583 }}""" # noqa: S608
587584
585+ post_update (query_remove_modified )
588586 post_update (query_add_modified )
589587 return now
590588
0 commit comments