Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Sep 21, 2023
1 parent d7ccb17 commit 04c76a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion astro-frontend/src/app/PageAnnotate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export default function PageAnnotate() {
return {
'@context': genericContext,
'@graph': stmtJsonld,
'@annotations': {
'@provenance': {
'@context': {
tao: 'http://pubannotation.org/ontology/tao.owl#',
rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
Expand Down
9 changes: 5 additions & 4 deletions backend/app/api/nanopub.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_np_config(user_id: str) -> NanopubConf:
"rdf:subject": {"@id": "drugbank:DB00001"},
"rdf:predicate": {"@id": "biolink:treats"},
"rdf:object": {"@id": "MONDO:0004975"},
# "@annotations": {
# "@provenance": {
# "@context": {
# "ml": "https://w3id.org/YOUR_ML_SCHEMA/"
# },
Expand Down Expand Up @@ -115,9 +115,9 @@ async def publish_assertion(
# nanopub_rdf = jsonld.expand(nanopub_rdf)
# nanopub_rdf = json.dumps(nanopub_rdf, ensure_ascii=False).encode("utf-8")

annotations_rdf = nanopub_rdf["@annotations"]
annotations_rdf = nanopub_rdf["@provenance"]

del nanopub_rdf["@annotations"]
del nanopub_rdf["@provenance"]
nanopub_rdf = json.dumps(nanopub_rdf)

g = Graph()
Expand Down Expand Up @@ -173,7 +173,8 @@ async def publish_assertion(

if annotations_rdf:
# Make sure annotations have the assertion as subject
annotations_rdf["@id"] = np.assertion.identifier
if "@graph" not in annotations_rdf and "@id" not in annotations_rdf:
annotations_rdf["@id"] = str(np.assertion.identifier)
np.provenance.parse(data=annotations_rdf, format="json-ld")
if source:
np.provenance.add((np.assertion.identifier, PROV.hadPrimarySource, URIRef(source)))
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/annotate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export default function AnnotateText() {
return {
'@context': genericContext,
'@graph': stmtJsonld,
'@annotations': {
'@provenance': {
'@context': {
tao: 'http://pubannotation.org/ontology/tao.owl#',
rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
Expand Down

0 comments on commit 04c76a8

Please sign in to comment.