query-e775fcd110824888ff4ad0a5c003f878

rq turtle/ttl

Applying regex to query. extract anything, but instead replace, but running this query (limited to just one file for testing purposes) does not return what I want; I don't think I actually want to the documentation for those functions, and read REPLACE and BIND variable, I'm stuck on trying to implement this in SPARQL. I thought I needed to use ?content to extract the strings from the the regex I need to use and obtained asked a Stack Overflow question, Thanks once again. Having Dipsacus fullonum@

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT * WHERE {
  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Generator";
                    wikibase:endpoint "commons.wikimedia.org";
                    mwapi:generator "revisions";
                    mwapi:pageids "64827585";
                    mwapi:gcmtype "file";
                    mwapi:gcmlimit "1";
                    mwapi:prop "revisions";
                    mwapi:rvslots "main";
                    mwapi:rvprop "content";
                    wikibase:limit "once".
    ?title wikibase:apiOutput mwapi:title.
    ?pageid wikibase:apiOutput mwapi:pageid.
    ?content wikibase:apiOutput 'revisions/rev/slots/slot/text()'.
  }
  BIND(REPLACE(?content, "section[^=]*=(.*?)\\|", "$1") AS ?section)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?content"):::projected v2("?pageid"):::projected v4("?section"):::projected v1("?title"):::projected c24(["mwapi:pageid"]):::iri c17(["main"]):::literal c19(["content"]):::literal c2(["bd:serviceParam"]):::iri c12(["file"]):::literal c8(["revisions"]):::literal c6(["commons.wikimedia.org"]):::literal c14(["1"]):::literal c21(["once"]):::literal c23(["mwapi:title"]):::iri c25(["revisions/rev/slots/slot/text()"]):::literal c10(["64827585"]):::literal c4(["Generator"]):::literal subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:api"--> c4 c2 --"mwapi:endpoint"--> c6 c2 --"mwapi:generator"--> c8 c2 --"mwapi:pageids"--> c10 c2 --"mwapi:gcmtype"--> c12 c2 --"mwapi:gcmlimit"--> c14 c2 --"mwapi:prop"--> c8 c2 --"mwapi:rvslots"--> c17 c2 --"mwapi:rvprop"--> c19 c2 --"mwapi:limit"--> c21 v1 --"mwapi:apiOutput"--> c23 v2 --"mwapi:apiOutput"--> c24 v3 --"mwapi:apiOutput"--> c25 end bind0[/"replace(?content,'section#91;^=#93;*=(.*?)\|','$1')"/] v3 --o bind0 bind0 --as--o v4