XQuery-based RDF Query Languages

Version:
$Revision: 1.10 $ of $Date: 2004/07/20 11:33:05 $
Author:
Eric Prud'hommeaux, eric@w3.org

Abstract

This document demonstrates some approaches to expressing RDF queries in XQuery. The examples include matilda and FA and contrast them with BRQL. The first examples demonstrate simple RDF queries in XQuery. The later FA queries motivate merging RDF data with data in other XML documents.

Status

These are notes from a working group breakout. They have no standing in the W3C process.

vcard

Search for vcard information in BRQL:

SELECT ?family , ?given
WHERE  (?vcard  vcard:FN "Alice Antwerp")
       (?vcard  vcard:N  ?name)
       (?name   vcard:Family  ?family)
       (?name   vcard:Given  ?given)
USING  vcard FOR <http://www.w3.org/2001/vcard-rdf/3.0#>

or in Matilda:

DECLARE ELEMENT NAMESPACE vcard = <http://www.w3.org/2001/vcard-rdf/3.0#>
FOR $vcard IN rdfNodes(), 
    $name IN rdfNodes(), 
    $family IN rdfNodes(), 
    $given IN rdfNodes()
WHERE asserted($vcard vcard:FN     "Alice Antwerp"), 
  AND asserted($vcard vcard:N      $name), 
  AND asserted($name  vcard:Family $family), 
  AND asserted($name  vcard:Given  $given) 
RETURN <p>$family $given</p>

selection on value

Use literal comparisons to select (in the relational algebra sense, σav(R)) in BRQL:

SELECT ?resource
WHERE (?resource info:age ?age)
AND ?age >= 24
USING info FOR <http://example.org/peopleInfo#>

or in Matilda:

DECLARE ELEMENT NAMESPACE info = <http://example.org/peopleInfo#>
FOR $resource IN rdfNodes(), 
WHERE asserted($resource info:age $age)
  AND ?age >= 24
RETURN <foo>$resource</foo>

Abstract Model of Where Clause

This is a quick start at an abstract algebra to represent the query functionality in BRQL that Matilda would need to match:

N is the set of RDF nodes.
$ is the set of variables.
Pos := N u $
C := Pos × Pos × Pos
Cexp := field(C, AND, OR) ... c1 AND c2 , c1 OR c2
B := $ × '=' × N
Bexp := field(B, AND, OR)
f(c ∈ C) -> b ∈ Bexp

XQuery with Functional Accessor Examples:

Who's on this system?

/var/utmp.xml has a set of records saying who's logged on and for how long.

Input:

<utmp>
  <user>
    <uid>1007</uid>
    <username>Ann</username>
    <logintime>23</logintime>
  </user>
  <user>
    <uid>1003</uid>
    <username>Bob</username>
    <logintime>18</logintime>
  </user>
</utmp>

FA Query:

<whoson>
   {
      for $record in doc('file://var/utmp.xml')/*/user
        let $given := rdf:doc('http://example.org/foaf.rdf')/rdf-has-subject-predicate($record/username, foaf:given)
        let $family := rdf:doc('http://example.org/foaf.rdf')/rdf-has-subject-predicate($record/username, foaf:family)
        return
<tr><td>$record/username</td><td>$record/logintime</td><td>$given</td><td>$family</td></tr>
   }</whoson>

Related Party Transactions

Bust people for pretending to sell commodities to co-conspirators.

@@@ in progress @@@

FA Query:

<fiends>
   {
      for $seller in doc('edgar.xml')/service
        for $buyer in $seller/to
          let $theMan := rdf:doc('fatcat.rdf')/rdf-has-subject-predicate($seller/ceo, vcard:FN)
          let $conspirator := rdf:doc('foaf.rdf')/rdf-has-subject-predicate($buyer/ceo, vcard:FN) AND 
                              rdf:doc('foaf.rdf')/rdf-has-subject-predicate-object($seller/ceo, foaf:knows, $buyer/ceo)
        return
<tr><td>$seller/name</td><td>$seller/price</td><td>$theMan</td><td>$conspirator</td></tr>
   }</finds>
<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0202</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2004-07-14</periodOfReport>

    <notSubjectToSection16>0</notSubjectToSection16>

    <issuer>
        <issuerCik>0001095858</issuerCik>
        <issuerName>IVAX DIAGNOSTICS INC</issuerName>
        <issuerTradingSymbol>IVD</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001199347</rptOwnerCik>
            <rptOwnerName>HARLEY JOHN</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>2140 NORTH MIAMI AVENUE</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>MIAMI</rptOwnerCity>
            <rptOwnerState>FL</rptOwnerState>
            <rptOwnerZipCode>33127</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>6.21</value>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2004-07-14</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>15000</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <value>2004-07-14</value>
            </exerciseDate>
            <expirationDate>
                <value>2011-07-13</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock, par value $0.01</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>15000</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>15000</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <ownerSignature>
        <signatureName>/s/ John B. Harley</signatureName>
        <signatureDate>2004-07-14</signatureDate>
    </ownerSignature>
</ownershipDocument>

link to the FOAF Fatcat Data