[ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/Head", "@graph": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU", "http://www.nanopub.org/nschema#hasAssertion": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/assertion" } ], "http://www.nanopub.org/nschema#hasProvenance": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/provenance" } ], "http://www.nanopub.org/nschema#hasPublicationInfo": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/pubinfo" } ], "@type": [ "http://www.nanopub.org/nschema#Nanopublication" ] } ] }, { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/provenance", "@graph": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/assertion", "http://www.w3.org/ns/prov#wasAttributedTo": [ { "@id": "https://w3id.org/np/RAFJKwxgChOLOQ2UduMAT1bYf1VNaWIZYIPmTT3YvJ8y0/docs-bot" } ] } ] }, { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/assertion", "@graph": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/paragraph", "http://schema.org/about": [ { "@id": "https://w3id.org/kpxl/grlc/grlc-query" } ], "http://schema.org/title": [ { "@value": "Writing the SPARQL into the TriG" } ], "@type": [ "https://w3id.org/kpxl/gen/terms/Paragraph" ], "https://w3id.org/kpxl/gen/terms/hasContent": [ { "@value": "
When a query nanopublication is written by hand, the SPARQL sits inside a TriG string literal, and the TriG parser resolves backslash escapes before the SPARQL is ever seen. Every backslash meant for the SPARQL must therefore be doubled in the file.
\nThe one that catches people is the separator of group_concat. Written as a single backslash, separator=\"\\n\" becomes a real line break inside a quoted SPARQL string, which is not valid SPARQL. Written as separator=\"\\\\n\" in the TriG, it reaches the query as the two characters that were intended.
The safe way to produce the file is to build it from the raw query text with the backslashes doubled programmatically, then parse the result back and check that the round-tripped literal still contains the escape rather than a line break.
" } ], "https://w3id.org/kpxl/gen/terms/hasPositionString": [ { "@value": "11" } ] } ] }, { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/pubinfo", "@graph": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU", "http://purl.org/dc/terms/created": [ { "@value": "2026-09-09T14:46:50Z", "@type": "http://www.w3.org/2001/XMLSchema#dateTime" } ], "http://purl.org/dc/terms/creator": [ { "@id": "https://w3id.org/np/RAFJKwxgChOLOQ2UduMAT1bYf1VNaWIZYIPmTT3YvJ8y0/docs-bot" } ], "http://purl.org/dc/terms/license": [ { "@id": "https://creativecommons.org/publicdomain/zero/1.0/" } ], "http://purl.org/nanopub/x/introduces": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/paragraph" } ], "http://www.w3.org/2000/01/rdf-schema#label": [ { "@value": "Writing the SPARQL into the TriG" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromProvenanceTemplate": [ { "@id": "https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromPubinfoTemplate": [ { "@id": "https://w3id.org/np/RA-N4_kFxcruvBTlo1yJv29E4SLOXsx5KO_th69PprMrA" }, { "@id": "https://w3id.org/np/RACJ58Gvyn91LqCKIO9zu1eijDQIeEff28iyDrJgjSJF8" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromTemplate": [ { "@id": "https://w3id.org/np/RAdxrv0Rie-65L6gdURjpy8nTt7YagghQfX20Zw4pR7t0" } ] }, { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU/sig", "http://purl.org/nanopub/x/hasAlgorithm": [ { "@value": "RSA" } ], "http://purl.org/nanopub/x/hasPublicKey": [ { "@value": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl8cMusqtNyKA6UIsi3f7BAcZmHQXWxU0qk0PLsboMWQxYrGBfGgHTgRHJrBRxL+Zn9kJHKVmz2smDcjCBptXi/OwWy80gjsx+Pbe6IWz3zFPWF1UoFIKfPnC0slV67CQgdM853zW7Bmk9/uflCtK4EtZKmPdRGtUHVC7DTVvDBMDzLRGdE2KCBVN29EbM5GGVNvijYbaZQ9OFQPBkQshayqSIyGRr6rreJdkrRVLIzu3uuAjKYydaeXZWSN2JLnVBwrClKUxaEdCwhb5nXpMtKOMD+R+LgaXLeJUWM8BdRSYnta9ZqI5pHY4y3v+eW7J+HHeTvRbHvlik+Z4hFUXmQIDAQAB" } ], "http://purl.org/nanopub/x/hasSignature": [ { "@value": "d5PHBPpVvYcPqElilRU9gphppdyl0vsEaPA1PupnJtta/ugfZ4Rxx0eHBC0U7khJDtmq/qFFdd23ibPcC7gX71VJJyTN/BNDKVojAjC7opVDipz+UEr/M644H/eX6zXvFlMB49UzdHb/PAkusq+D9KJ7XYpjKy2B8sYF/cvf4J8rHwb8zCbEuYYDKMX8bsPdwWzxsey3eg255diI+gkQYFNOtN3IWMoWCel5YZl2f3ICq4sy6tyJnjO6y1NwbWAOfB9MKdxQN3wUSkzeEXUdq8XiJdg1smb9X8Cw45rMb//TSUokHzlXiKvGVN6TIeQs3FkZzo1AjI0+3KEZEYap6A==" } ], "http://purl.org/nanopub/x/hasSignatureTarget": [ { "@id": "https://w3id.org/np/RAYcriHlII62-eAYy91vOZ6WG5QmEc2juBM4XLu9U26aU" } ], "http://purl.org/nanopub/x/signedBy": [ { "@id": "https://w3id.org/np/RAFJKwxgChOLOQ2UduMAT1bYf1VNaWIZYIPmTT3YvJ8y0/docs-bot" } ] } ] } ]