({{, SPARQLLoad[from] 
is an update operator that can be applied to an (PackageLink[RDFStore, paclet:GraphStore/ref/RDFStore, GraphStore Package Symbol]), which loads the graph located at from into the default graph.}, {, SPARQLLoad[from->to]
loads the graph into the graph identified by to.}})

OpenersNotesSection(Spacer1)Details

SPARQLLoad can be used in (PackageLink[SPARQLExecute, paclet:GraphStore/ref/SPARQLExecute, GraphStore Package Symbol]) to load data into a SPARQL endpoint.

from is usually a (RefLink[URL, paclet:ref/URL]) or a (RefLink[File, paclet:ref/File]) that contains the graph.

Data from the destination graph is not removed.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Needs["GraphStore`"]

Data about countries:

countryStore=ImportString["
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix wa: <http://www.wolframalpha.com/input/?i=>
prefix ex: <http://example.org/>

wa:Entity%5B%22Country%22%2C%22Spain%22%5D
 rdfs:label \"Spain\"@en ;
 ex:population 46528024 .
wa:Entity%5B%22Country%22%2C%22Hungary%22%5D
 rdfs:label \"Hungary\"@en ;
 ex:population 9778371 .
","TriG"]

Create a "linkset" that links Wolfram and Wikidata entities:

linkFile=File[CreateFile["links.ttl"]];

WriteString[linkFile,"
prefix wa: <http://www.wolframalpha.com/input/?i=>
prefix wd: <http://www.wikidata.org/entity/>
prefix owl: <http://www.w3.org/2002/07/owl#>

wa:Entity%5B%22Country%22%2C%22Spain%22%5D owl:sameAs wd:Q29 .
wa:Entity%5B%22Country%22%2C%22Hungary%22%5D owl:sameAs wd:Q28 .
"]

Load the linkset into the default graph:

countryStore=countryStore//SPARQLLoad[linkFile]

Query the population of Hungary using its Wikidata ID (Q28):

countryStore//SPARQLQuery["
prefix wd: <http://www.wikidata.org/entity/>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix ex: <http://example.org/>

SELECT * WHERE {
 wd:Q28 ^owl:sameAs / ex:population ?population .
}
"]

Delete the linkset:

DeleteFile[linkFile]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(PackageLink[SPARQLClear, paclet:GraphStore/ref/SPARQLClear, GraphStore Package Symbol])  ▪  (PackageLink[SPARQLUpdate, paclet:GraphStore/ref/SPARQLUpdate, GraphStore Package Symbol])  ▪  (PackageLink[RDFStore, paclet:GraphStore/ref/RDFStore, GraphStore Package Symbol])  ▪  (PackageLink[SPARQLSelect, paclet:GraphStore/ref/SPARQLSelect, GraphStore Package Symbol])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Writing To RDF Stores Using SPARQL, paclet:GraphStore/guide/SPARQLUpdate])}, {▪(RefLinkPlain[Graph Store Overview, paclet:GraphStore/guide/GraphStoreOverview])}})}})