I am trying to learn the RDF Triple Store feature and Marklogic 7 semantic search capabilities , and then query using SPARQL . I was able to perform some basic operations, for example:
xquery version "1.0-ml"; import module namespace sem = "http://marklogic.com/semantics"at"/MarkLogic/semantics.xqy"; sem:rdf-insert(sem:triple(sem:iri("http://example.org/ns/people#m"), sem:iri("http://example.com/ns/person#firstName"), "Sam"),(),(),"my collection")
which creates a triple and then queries it using the following SPARQL:
PREFIX ab: <http://example.org/ns/people#> PREFIX ac: <http://example.com/ns/person#> SELECT ?Name WHERE { ab:m ac:firstName ?Name . }
which returns the result of Sam. Edited . In my use case, I have a delimited file (structured data) having 1 billion records that I swallowed in ML using MLCP, which is stored in ML, for example:
<root> <ID>1000-000-000--000</ID> <ACCOUNT_NUM>9999</ACCOUNT_NUM> <NAME>Vronik</NAME> <ADD1>D7-701</ADD1> <ADD2>B-Valentine</ADD2> <ADD3>Street 4</ADD3> <ADD4>Fifth Avenue</ADD4> <CITY>New York</CITY> <STATE>NY</STATE> <HOMPHONE>0002600000</HOMPHONE> <BASEPHONE>12345</BASEPHONE> <CELLPHONE>54321</CELLPHONE> <EMAIL_ADDR> abc@gmail.com </EMAIL_ADDR> <CURRENT_BALANCE>10000</CURRENT_BALANCE> <OWNERSHIP>JOINT</OWNERSHIP> </root>
Now I want to use the RDF / Semantic function for my dataset above. However, I cannot figure out whether to convert the above document to RDF, as shown below (shown for <NAME> ), considering this to be correct:
<sem:triple> <sem:subject>unique/uri/Person </sem:subject> <sem:predicate>unique/uri/Name </sem:predicate> <sem:object datatype="http://www.w3.org/2001/XMLSchema#string" xml:lang="en">Vronik </sem:object> </sem:triple>
and then swallow these documents in ML and perform a search using SPARQL, or I just need to swallow my documents, and then separately receive triples obtained from external sources and somehow (like .. ??) associate them with my documents, and then query using SPARQL? Or is there another way I have to do this?