0

I'm trying to do a select all query on my friend's dataset. I have some concern about the design of his RDF dataset, as the URI for every client is different. In that case, how is a select all query possible? This is my first time working with RDF, so maybe my guess is wrong.

Here's the data:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:ontoex="http://www.semanticweb.org/home/ontologies/2016/10/ex#"
    xmlns:ex="http://example.com/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <ontoex:DataRecipient rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#unrelated">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  </ontoex:DataRecipient>
  <ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,">
    <ex:hasBdDate>
      <ex:BdDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,BdDate">
        <ex:hasValue>31/12/2011</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:BdDate>
    </ex:hasBdDate>
    <ex:hasAge>
      <ex:Age rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,Age">
        <ex:hasValue>4</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:Age>
    </ex:hasAge>
    <ex:hasAdress>
      <ex:Adress rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,Adress">
        <ex:hasValue>ergdrg</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:Adress>
    </ex:hasAdress>
    <ex:hasIdentityCard>
      <ex:IdentityCard rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,IdentityCard">
        <ex:hasNumber>
          <ex:IdentityCardNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,IdentityCardNumber">
            <ex:hasValue>10521</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardNumber>
        </ex:hasNumber>
        <ex:hasExpirationDate>
          <ex:IdentityCardExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,IdentityCardExpirationDate">
            <ex:hasValue>14/12/2018</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasDeliveryDate>
          <ex:IdentityCardDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,IdentityCardDeliveryDate">
            <ex:hasValue>12/12/2014</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardDeliveryDate>
        </ex:hasDeliveryDate>
      </ex:IdentityCard>
    </ex:hasIdentityCard>
    <ex:hasPassPort>
      <ex:PassPort rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,PassPort">
        <ex:hasNumber>
          <ex:PassPortNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,PassPortNumber">
            <ex:hasValue></ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortNumber>
        </ex:hasNumber>
        <ex:hasExpirationDate>
          <ex:PassPortExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,PassPortExpirationDate">
            <ex:hasValue></ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasDeliveryDate>
          <ex:PassPortDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#ergergghbjk,PassPortDeliveryDate">
            <ex:hasValue></ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortDeliveryDate>
        </ex:hasDeliveryDate>
      </ex:PassPort>
    </ex:hasPassPort>
    <ex:hasService>
      <ontoex:LandTransportationService rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#BuyBusTicket">
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
      </ontoex:LandTransportationService>
    </ex:hasService>
  </ex:Client>
  <ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Taleb">
    <ex:hasPassPort>
      <ex:PassPort rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebPassPort">
        <ex:hasDeliveryDate>
          <ex:PassPortDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebPassPortDeliveryDate">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue></ex:hasValue>
          </ex:PassPortDeliveryDate>
        </ex:hasDeliveryDate>
        <ex:hasExpirationDate>
          <ex:PassPortExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebPassPortExpirationDate">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue></ex:hasValue>
          </ex:PassPortExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasNumber>
          <ex:PassPortNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebPassPortNumber">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue></ex:hasValue>
          </ex:PassPortNumber>
        </ex:hasNumber>
      </ex:PassPort>
    </ex:hasPassPort>
    <ex:hasIdentityCard>
      <ex:IdentityCard rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebIdentityCard">
        <ex:hasDeliveryDate>
          <ex:IdentityCardDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebIdentityCardDeliveryDate">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue>20/12/2013</ex:hasValue>
          </ex:IdentityCardDeliveryDate>
        </ex:hasDeliveryDate>
        <ex:hasExpirationDate>
          <ex:IdentityCardExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebIdentityCardExpirationDate">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue>18/12/2020</ex:hasValue>
          </ex:IdentityCardExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasNumber>
          <ex:IdentityCardNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebIdentityCardNumber">
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasValue>561</ex:hasValue>
          </ex:IdentityCardNumber>
        </ex:hasNumber>
      </ex:IdentityCard>
    </ex:hasIdentityCard>
    <ex:hasAdress>
      <ex:Adress rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebAdress">
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasValue>binjk,l</ex:hasValue>
      </ex:Adress>
    </ex:hasAdress>
    <ex:hasAge>
      <ex:Age rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebAge">
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasValue>2</ex:hasValue>
      </ex:Age>
    </ex:hasAge>
    <ex:hasBdDate>
      <ex:BdDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#TalebBdDate">
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasValue>20/12/2013</ex:hasValue>
      </ex:BdDate>
    </ex:hasBdDate>
  </ex:Client>
  <ontoex:DataPurpose rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#contact">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  </ontoex:DataPurpose>
  <ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Djamel">
    <ex:hasFirstName>
      <ex:FirstName rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelFirstName">
        <ex:hasValue>Nom</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:FirstName>
    </ex:hasFirstName>
    <ex:hasLastName>
      <ex:LastName rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelLastName">
        <ex:hasValue>Prenom</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:LastName>
    </ex:hasLastName>
    <ex:hasIdentityCard>
      <ex:IdentityCard rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelIdentityCard">
        <ex:hasNumber>
          <ex:IdentityCardNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelIdentityCardNumber">
            <ex:hasValue>95175364</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardNumber>
        </ex:hasNumber>
        <ex:hasExpirationDate>
          <ex:IdentityCardExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelIdentityCardExpirationDate">
            <ex:hasValue>11/06/2021</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasDeliveryDate>
          <ex:IdentityCardDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelIdentityCardDeliveryDate">
            <ex:hasValue>10/06/2016</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:IdentityCardDeliveryDate>
        </ex:hasDeliveryDate>
      </ex:IdentityCard>
    </ex:hasIdentityCard>
    <ex:hasDriverLicense>
      <ex:DriverLicense rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelDriverLicense">
        <ex:hasNumber>
          <ex:DriverLicenseNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelDriverLicenseNumber">
            <ex:hasValue>0123456789</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:DriverLicenseNumber>
        </ex:hasNumber>
        <ex:hasExpirationDate>
          <ex:DriverLicenseExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelDriverLicenseExpirationDate">
            <ex:hasValue>19/06/2024</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:DriverLicenseExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasDeliveryDate>
          <ex:DriverLicenseDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelDriverLicenseDeliveryDate">
            <ex:hasValue>13/06/2014</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:DriverLicenseDeliveryDate>
        </ex:hasDeliveryDate>
      </ex:DriverLicense>
    </ex:hasDriverLicense>
    <ex:hasPassPort>
      <ex:PassPort rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelPassPort">
        <ex:hasNumber>
          <ex:PassPortNumber rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelPassPortNumber">
            <ex:hasValue>987654321</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortNumber>
        </ex:hasNumber>
        <ex:hasExpirationDate>
          <ex:PassPortExpirationDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelPassPortExpirationDate">
            <ex:hasValue>11/06/2026</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortExpirationDate>
        </ex:hasExpirationDate>
        <ex:hasDeliveryDate>
          <ex:PassPortDeliveryDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelPassPortDeliveryDate">
            <ex:hasValue>25/06/2016</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:PassPortDeliveryDate>
        </ex:hasDeliveryDate>
      </ex:PassPort>
    </ex:hasPassPort>
    <ex:hasAdress>
      <ex:Adress rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelAdress">
        <ex:hasValue>Mon Adresse</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:Adress>
    </ex:hasAdress>
    <ex:hasCreditCard>
      <ex:CreditCard rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelCreditCard">
        <ex:hasNumber>
          <rdf:Description rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelCreditCardNumber">
            <ex:hasValue>123456789</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </rdf:Description>
        </ex:hasNumber>
        <ex:hasCCType>
          <ex:CCType rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelCCType">
            <ex:hasValue>Visa</ex:hasValue>
            <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
            <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
            <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
          </ex:CCType>
        </ex:hasCCType>
      </ex:CreditCard>
    </ex:hasCreditCard>
    <ex:hasBdDate>
      <ex:BdDate rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelBdDate">
        <ex:hasValue>19/06/1991</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:BdDate>
    </ex:hasBdDate>
    <ex:hasAge>
      <ex:Age rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#DjamelAge">
        <ex:hasValue>25</ex:hasValue>
        <ex:hasRetention rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#no-retention"/>
        <ex:hasRecipient rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#ours"/>
        <ex:hasPurpose rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#current"/>
      </ex:Age>
    </ex:hasAge>
    <ex:hasService rdf:resource="http://www.semanticweb.org/home/ontologies/2016/10/ex#RentVehicle"/>
  </ex:Client>
</rdf:RDF>

In summary, we have

<ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Taleb"> 
<ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Djamel">

We want to get all data about Taleb and Djamel. Beyond that, how can I write a similar query when there are more than two clients?

Mark Miller
  • 3,011
  • 1
  • 14
  • 34

1 Answers1

3

It's great that you shared your data. I made some edits, because it wasn't complete RDF as posted:

  • the ex: prefix was not defined
  • it wasn't wrapped in opening and closing <rdf:RDF> tags

Additionally

  • many people would find your data easier to read in TURTLE format, as opposed to the RDF/XML format you posted
  • you should also consider giving human-readable rdfs:labels to all of your entities like <http://www.semanticweb.org/home/ontologies/2016/10/ex#Djamel>
  • I find it a little strange that the hasValue object of DjamelFirstName is Nom, not Djamel. Is this a case of label/value confusion?

Here's a SO answer listing some training materials you could try.

And here's a fragment of your data, in Turtle format, and with labels:

@prefix ex:    <http://www.semanticweb.org/home/ontologies/2016/10/ex#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

ex:DjamelFirstName  a    ex:FirstName ;
        rdfs:label       "Djamel's first name" ;
        ex:hasPurpose    ex:current ;
        ex:hasRecipient  ex:ours ;
        ex:hasRetention  ex:no-retention ;
        ex:hasValue      "Nom" .

ex:Djamel  a                 ex:Client ;
        rdfs:label           "Client 'Djamel'" ;
        ex:hasAdress         ex:DjamelAdress ;
        ex:hasAge            ex:DjamelAge ;
        ex:hasBdDate         ex:DjamelBdDate ;
        ex:hasCreditCard     ex:DjamelCreditCard ;
        ex:hasDriverLicense  ex:DjamelDriverLicense ;
        ex:hasFirstName      ex:DjamelFirstName ;
        ex:hasIdentityCard   ex:DjamelIdentityCard ;
        ex:hasLastName       ex:DjamelLastName ;
        ex:hasPassPort       ex:DjamelPassPort ;
        ex:hasService        ex:RentVehicle .

The last two lines of your question provide a hint towards the answer: if you want to find information about two instances of the RDF same class (ex:Client), you should ask for all members of that class.

<ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Taleb"> 
<ex:Client rdf:about="http://www.semanticweb.org/home/ontologies/2016/10/ex#Djamel">

That's where the ?s a ex:Client part of the query comes from.

Your data model looks generally reasonable to me, but you'll have to deal with the fact that it is nested. For example, ex:Djamel doesn't have a direct relationship with a string literal representing his(?) name.

I have written a query that goes down one level of nesting. If your data actually use deeper nesting, you'll need to modify the query.

PREFIX  ex:   <http://www.semanticweb.org/home/ontologies/2016/10/ex#>
SELECT  *
WHERE
  { ?s  a    ex:Client .
    ?s  ?p1  ?o1 .
    OPTIONAL
      { ?o1  ?p2  ?o2 } .
  }

gives

+-----------------+-------------------------------------------------+-----------------------------+-------------------------------------------------+-----------------------------------------------+
|        s        |                       p1                        |             o1              |                       p2                        |                      o2                       |
+-----------------+-------------------------------------------------+-----------------------------+-------------------------------------------------+-----------------------------------------------+
| ex:Djamel       | ex:hasFirstName                                 | ex:DjamelFirstName          | ex:hasPurpose                                   | ex:current                                    |
| ex:Djamel       | ex:hasFirstName                                 | ex:DjamelFirstName          | ex:hasRecipient                                 | ex:ours                                       |
| ex:Djamel       | ex:hasFirstName                                 | ex:DjamelFirstName          | ex:hasRetention                                 | ex:no-retention                               |
| ex:Djamel       | ex:hasFirstName                                 | ex:DjamelFirstName          | ex:hasValue                                     | Nom                                           |
| ex:Djamel       | ex:hasFirstName                                 | ex:DjamelFirstName          | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:FirstName                                  |
| ex:Djamel       | ex:hasIdentityCard                              | ex:DjamelIdentityCard       | ex:hasDeliveryDate                              | ex:DjamelIdentityCardDeliveryDate             |
| ex:Djamel       | ex:hasIdentityCard                              | ex:DjamelIdentityCard       | ex:hasExpirationDate                            | ex:DjamelIdentityCardExpirationDate           |
| ex:Djamel       | ex:hasIdentityCard                              | ex:DjamelIdentityCard       | ex:hasNumber                                    | ex:DjamelIdentityCardNumber                   |
| ex:Djamel       | ex:hasIdentityCard                              | ex:DjamelIdentityCard       | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:IdentityCard                               |
| ex:Djamel       | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Class    |
| ex:Djamel       | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Resource |
| ex:Djamel       | ex:hasAdress                                    | ex:DjamelAdress             | ex:hasPurpose                                   | ex:current                                    |
| ex:Djamel       | ex:hasAdress                                    | ex:DjamelAdress             | ex:hasRecipient                                 | ex:ours                                       |
| ex:Djamel       | ex:hasAdress                                    | ex:DjamelAdress             | ex:hasRetention                                 | ex:no-retention                               |
| ex:Djamel       | ex:hasAdress                                    | ex:DjamelAdress             | ex:hasValue                                     | Mon Adresse                                   |
| ex:Djamel       | ex:hasAdress                                    | ex:DjamelAdress             | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Adress                                     |
| ex:Djamel       | ex:hasBdDate                                    | ex:DjamelBdDate             | ex:hasPurpose                                   | ex:current                                    |
| ex:Djamel       | ex:hasBdDate                                    | ex:DjamelBdDate             | ex:hasRecipient                                 | ex:ours                                       |
| ex:Djamel       | ex:hasBdDate                                    | ex:DjamelBdDate             | ex:hasRetention                                 | ex:no-retention                               |
| ex:Djamel       | ex:hasBdDate                                    | ex:DjamelBdDate             | ex:hasValue                                     | 19/06/1991                                    |
| ex:Djamel       | ex:hasBdDate                                    | ex:DjamelBdDate             | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:BdDate                                     |
| ex:Djamel       | ex:hasCreditCard                                | ex:DjamelCreditCard         | ex:hasCCType                                    | ex:DjamelCCType                               |
| ex:Djamel       | ex:hasCreditCard                                | ex:DjamelCreditCard         | ex:hasNumber                                    | ex:DjamelCreditCardNumber                     |
| ex:Djamel       | ex:hasCreditCard                                | ex:DjamelCreditCard         | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:CreditCard                                 |
| ex:Djamel       | ex:hasPassPort                                  | ex:DjamelPassPort           | ex:hasDeliveryDate                              | ex:DjamelPassPortDeliveryDate                 |
| ex:Djamel       | ex:hasPassPort                                  | ex:DjamelPassPort           | ex:hasExpirationDate                            | ex:DjamelPassPortExpirationDate               |
| ex:Djamel       | ex:hasPassPort                                  | ex:DjamelPassPort           | ex:hasNumber                                    | ex:DjamelPassPortNumber                       |
| ex:Djamel       | ex:hasPassPort                                  | ex:DjamelPassPort           | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:PassPort                                   |
| ex:Djamel       | ex:hasDriverLicense                             | ex:DjamelDriverLicense      | ex:hasDeliveryDate                              | ex:DjamelDriverLicenseDeliveryDate            |
| ex:Djamel       | ex:hasDriverLicense                             | ex:DjamelDriverLicense      | ex:hasExpirationDate                            | ex:DjamelDriverLicenseExpirationDate          |
| ex:Djamel       | ex:hasDriverLicense                             | ex:DjamelDriverLicense      | ex:hasNumber                                    | ex:DjamelDriverLicenseNumber                  |
| ex:Djamel       | ex:hasDriverLicense                             | ex:DjamelDriverLicense      | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:DriverLicense                              |
| ex:Djamel       | ex:hasLastName                                  | ex:DjamelLastName           | ex:hasPurpose                                   | ex:current                                    |
| ex:Djamel       | ex:hasLastName                                  | ex:DjamelLastName           | ex:hasRecipient                                 | ex:ours                                       |
| ex:Djamel       | ex:hasLastName                                  | ex:DjamelLastName           | ex:hasRetention                                 | ex:no-retention                               |
| ex:Djamel       | ex:hasLastName                                  | ex:DjamelLastName           | ex:hasValue                                     | Prenom                                        |
| ex:Djamel       | ex:hasLastName                                  | ex:DjamelLastName           | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:LastName                                   |
| ex:Djamel       | ex:hasService                                   | ex:RentVehicle              | NA                                              | NA                                            |
| ex:Djamel       | ex:hasAge                                       | ex:DjamelAge                | ex:hasPurpose                                   | ex:current                                    |
| ex:Djamel       | ex:hasAge                                       | ex:DjamelAge                | ex:hasRecipient                                 | ex:ours                                       |
| ex:Djamel       | ex:hasAge                                       | ex:DjamelAge                | ex:hasRetention                                 | ex:no-retention                               |
| ex:Djamel       | ex:hasAge                                       | ex:DjamelAge                | ex:hasValue                                     | 25                                            |
| ex:Djamel       | ex:hasAge                                       | ex:DjamelAge                | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Age                                        |
| ex:ergergghbjk_ | ex:hasAdress                                    | ex:ergergghbjk_Adress       | ex:hasPurpose                                   | ex:current                                    |
| ex:ergergghbjk_ | ex:hasAdress                                    | ex:ergergghbjk_Adress       | ex:hasRecipient                                 | ex:ours                                       |
| ex:ergergghbjk_ | ex:hasAdress                                    | ex:ergergghbjk_Adress       | ex:hasRetention                                 | ex:no-retention                               |
| ex:ergergghbjk_ | ex:hasAdress                                    | ex:ergergghbjk_Adress       | ex:hasValue                                     | ergdrg                                        |
| ex:ergergghbjk_ | ex:hasAdress                                    | ex:ergergghbjk_Adress       | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Adress                                     |
| ex:ergergghbjk_ | ex:hasAge                                       | ex:ergergghbjk_Age          | ex:hasPurpose                                   | ex:current                                    |
| ex:ergergghbjk_ | ex:hasAge                                       | ex:ergergghbjk_Age          | ex:hasRecipient                                 | ex:ours                                       |
| ex:ergergghbjk_ | ex:hasAge                                       | ex:ergergghbjk_Age          | ex:hasRetention                                 | ex:no-retention                               |
| ex:ergergghbjk_ | ex:hasAge                                       | ex:ergergghbjk_Age          | ex:hasValue                                     | 4                                             |
| ex:ergergghbjk_ | ex:hasAge                                       | ex:ergergghbjk_Age          | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Age                                        |
| ex:ergergghbjk_ | ex:hasBdDate                                    | ex:ergergghbjk_BdDate       | ex:hasPurpose                                   | ex:current                                    |
| ex:ergergghbjk_ | ex:hasBdDate                                    | ex:ergergghbjk_BdDate       | ex:hasRecipient                                 | ex:ours                                       |
| ex:ergergghbjk_ | ex:hasBdDate                                    | ex:ergergghbjk_BdDate       | ex:hasRetention                                 | ex:no-retention                               |
| ex:ergergghbjk_ | ex:hasBdDate                                    | ex:ergergghbjk_BdDate       | ex:hasValue                                     | 31/12/2011                                    |
| ex:ergergghbjk_ | ex:hasBdDate                                    | ex:ergergghbjk_BdDate       | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:BdDate                                     |
| ex:ergergghbjk_ | ex:hasIdentityCard                              | ex:ergergghbjk_IdentityCard | ex:hasDeliveryDate                              | ex:ergergghbjk_IdentityCardDeliveryDate       |
| ex:ergergghbjk_ | ex:hasIdentityCard                              | ex:ergergghbjk_IdentityCard | ex:hasExpirationDate                            | ex:ergergghbjk_IdentityCardExpirationDate     |
| ex:ergergghbjk_ | ex:hasIdentityCard                              | ex:ergergghbjk_IdentityCard | ex:hasNumber                                    | ex:ergergghbjk_IdentityCardNumber             |
| ex:ergergghbjk_ | ex:hasIdentityCard                              | ex:ergergghbjk_IdentityCard | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:IdentityCard                               |
| ex:ergergghbjk_ | ex:hasPassPort                                  | ex:ergergghbjk_PassPort     | ex:hasDeliveryDate                              | ex:ergergghbjk_PassPortDeliveryDate           |
| ex:ergergghbjk_ | ex:hasPassPort                                  | ex:ergergghbjk_PassPort     | ex:hasExpirationDate                            | ex:ergergghbjk_PassPortExpirationDate         |
| ex:ergergghbjk_ | ex:hasPassPort                                  | ex:ergergghbjk_PassPort     | ex:hasNumber                                    | ex:ergergghbjk_PassPortNumber                 |
| ex:ergergghbjk_ | ex:hasPassPort                                  | ex:ergergghbjk_PassPort     | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:PassPort                                   |
| ex:ergergghbjk_ | ex:hasService                                   | ex:BuyBusTicket             | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2002/07/owl#NamedIndividual |
| ex:ergergghbjk_ | ex:hasService                                   | ex:BuyBusTicket             | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:LandTransportationService                  |
| ex:ergergghbjk_ | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Class    |
| ex:ergergghbjk_ | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Resource |
| ex:Taleb        | ex:hasAdress                                    | ex:TalebAdress              | ex:hasPurpose                                   | ex:current                                    |
| ex:Taleb        | ex:hasAdress                                    | ex:TalebAdress              | ex:hasRecipient                                 | ex:ours                                       |
| ex:Taleb        | ex:hasAdress                                    | ex:TalebAdress              | ex:hasRetention                                 | ex:no-retention                               |
| ex:Taleb        | ex:hasAdress                                    | ex:TalebAdress              | ex:hasValue                                     | binjk,l                                       |
| ex:Taleb        | ex:hasAdress                                    | ex:TalebAdress              | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Adress                                     |
| ex:Taleb        | ex:hasAge                                       | ex:TalebAge                 | ex:hasPurpose                                   | ex:current                                    |
| ex:Taleb        | ex:hasAge                                       | ex:TalebAge                 | ex:hasRecipient                                 | ex:ours                                       |
| ex:Taleb        | ex:hasAge                                       | ex:TalebAge                 | ex:hasRetention                                 | ex:no-retention                               |
| ex:Taleb        | ex:hasAge                                       | ex:TalebAge                 | ex:hasValue                                     | 2                                             |
| ex:Taleb        | ex:hasAge                                       | ex:TalebAge                 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Age                                        |
| ex:Taleb        | ex:hasBdDate                                    | ex:TalebBdDate              | ex:hasPurpose                                   | ex:current                                    |
| ex:Taleb        | ex:hasBdDate                                    | ex:TalebBdDate              | ex:hasRecipient                                 | ex:ours                                       |
| ex:Taleb        | ex:hasBdDate                                    | ex:TalebBdDate              | ex:hasRetention                                 | ex:no-retention                               |
| ex:Taleb        | ex:hasBdDate                                    | ex:TalebBdDate              | ex:hasValue                                     | 20/12/2013                                    |
| ex:Taleb        | ex:hasBdDate                                    | ex:TalebBdDate              | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:BdDate                                     |
| ex:Taleb        | ex:hasIdentityCard                              | ex:TalebIdentityCard        | ex:hasDeliveryDate                              | ex:TalebIdentityCardDeliveryDate              |
| ex:Taleb        | ex:hasIdentityCard                              | ex:TalebIdentityCard        | ex:hasExpirationDate                            | ex:TalebIdentityCardExpirationDate            |
| ex:Taleb        | ex:hasIdentityCard                              | ex:TalebIdentityCard        | ex:hasNumber                                    | ex:TalebIdentityCardNumber                    |
| ex:Taleb        | ex:hasIdentityCard                              | ex:TalebIdentityCard        | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:IdentityCard                               |
| ex:Taleb        | ex:hasPassPort                                  | ex:TalebPassPort            | ex:hasDeliveryDate                              | ex:TalebPassPortDeliveryDate                  |
| ex:Taleb        | ex:hasPassPort                                  | ex:TalebPassPort            | ex:hasExpirationDate                            | ex:TalebPassPortExpirationDate                |
| ex:Taleb        | ex:hasPassPort                                  | ex:TalebPassPort            | ex:hasNumber                                    | ex:TalebPassPortNumber                        |
| ex:Taleb        | ex:hasPassPort                                  | ex:TalebPassPort            | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:PassPort                                   |
| ex:Taleb        | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Class    |
| ex:Taleb        | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | ex:Client                   | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/2000/01/rdf-schema#Resource |
+-----------------+-------------------------------------------------+-----------------------------+-------------------------------------------------+-----------------------------------------------+
Mark Miller
  • 3,011
  • 1
  • 14
  • 34
  • thanks, for your great observation : I ll search to how use a turtle format using java jena, also I m sorry the data was not full because there was more than 50 Client instance so I did my best getting those 2, Also the hasValue was only a confusion my bad. All I want to ask about do P1 and P2 means properties and P2 is nested on P1 , does O1 and O2 mean Object ( or Value ) ??? – Mohammed Housseyn Taleb Jun 17 '17 at 04:33
  • And knowing this is my first time using this technology would you recomande mes 2 books for in this feald one for starting and another for mastering semantic and sparql. this is so interesseting – Mohammed Housseyn Taleb Jun 17 '17 at 04:36
  • 1
    I have made some edits to my answer (which are visible already) and your question (which may take a while to post.) I added a link with book & tutorial suggestions. I removed the semicolon (`;`) shortcut from the query, which some beginners find confusing. I added the `optional ` keyword... that would find any literal annotations on an entity like ex:Djamel, *if there were any*. – Mark Miller Jun 17 '17 at 13:18
  • 1
    In terms of converting from `RDF/XML` to `Turtle`... if you start a new question and show a little work on your part, I (or somebody else) can help you. PS, I use Scala and RDF4J, not Java and Jena. – Mark Miller Jun 17 '17 at 13:19
  • 1
    Yes, `?p1` and `?p2` are properties or predicates, depending on whether you're an OWL person on an RDF person. You could use other variable names if they made more sense to you. `?o1` represents all of the objects of `?p1` relationships with the `?s` subject. Those could be literal values (like labels) if you had any, or they can be URIs for other entities. `?o2` represents all of the objects of `?p2` relationships with `?o1`, as long as `?o1` is an entity, not a literal. `?o2` literal values or objects are not directly connected to the client subjects... that's why I say "nested" – Mark Miller Jun 17 '17 at 13:33