What Combination SPARQL Query should be used to query phone numbers from
documents where field names vary?

I'd like to used triples to do the field mapping.

The following triples are may be used to map the various phone number fields
to dom:phone.

PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX fibo: <http://example.com/fibo/>
PREFIX dom:  <http://example.com/products/>

INSERT DATA
{
  GRAPH <http://example.com/field-mappings-1>
  {
    fibo:FullPhoneNumber rdf:type dom:phone .
    fibo:CUPHONE         rdf:type dom:phone .
    fibo:Telephone       rdf:type dom:phone .
    fibo:TEL-TYPE-1      rdf:type dom:phone .
  }
}


Here are the 3 XML documents that use different field names for a telephone
number.

/party/1001.xml

<fibo:Party xmlns:aptp="http://example.com/fibo";>
    <fibo:Source>SystemA</fibo:Source>
    <fibo:Customer>Xerox</fibo:Customer>
    <fibo:Created>2016-02-26</fibo:Created>
    <fibo:LastModified>2016-02-26</fibo:LastModified>
    <fibo:Person>
        <fibo:FullName>Grace Hopper</fibo:FullName>
        <fibo:FullPhoneNumber>11-301-555-1212</fibo:FullPhoneNumber>
        <fibo:city>Sunnyvale</fibo:city>
        <fibo:state>California</fibo:state>
    </fibo:Person>
</fibo:Party>


/party/1002.xml

<fibo:Party xmlns:aptp="http://example.com/fibo";>
    <fibo:Source>SystemB</fibo:Source>
    <fibo:Customer>Apple</fibo:Customer>
    <fibo:Created>2016-02-26</fibo:Created>
    <fibo:LastModified>2016-02-26</fibo:LastModified>
    <fibo:Person>
        <fibo:FullName>Marissa Mayer</fibo:FullName>
        <fibo:CUPHONE>11-301-555-4444</fibo:CUPHONE>
        <fibo:city>Los Angeles</fibo:city>
        <fibo:state>California</fibo:state>
    </fibo:Person>
</fibo:Party>


/party/1003.xml

<fibo:Party xmlns:aptp="http://example.com/fibo";>
    <fibo:Source>SystemC</fibo:Source>
    <fibo:Customer>Microsoft</fibo:Customer>
    <fibo:Created>2016-02-26</fibo:Created>
    <fibo:LastModified>2016-02-26</fibo:LastModified>
    <fibo:Person>
        <fibo:FullName>Sheryl Sandberg</fibo:FullName>
        <fibo:Telephone type="1">301-555-1212</fibo:Telephone>
        <fibo:city>Redmond</fibo:city>
        <fibo:state>Washington</fibo:state>
    </fibo:Person>
</fibo:Party>


What query should be used to retrieve the phone numbers for all 3 documents
using the field mapping triples noted above?

Any thoughts/advice on this is much appreciated.

Regards,
Gary Russo



_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to