title: Sparql query for RDF and mutilple attribute values
body: <p>hi i want to write a query for :</p>
  
  <pre><code>&lt;car name="BMW"&gt;
  
  &lt;attribute =speed=""&gt;
  
  &lt;value&gt;1.5&lt;/value&gt;
  
  &lt;/attribute&gt;
  
  &lt;attribute =weight=""&gt;
  
  &lt;value&gt;30&lt;/value&gt;
  
  &lt;/attribute&gt;
  
  &lt;/car&gt;
  </code></pre>
  
  <p>i want the output in the format : BMW has speed 1.5 and weight 30. i have converted the above into RDF but i cant get my desired results. any help?
  hi my actual data is from XML file , and i converted into RDF:</p>
  
  <p>i created this ontology:</p>
  
  <pre><code>    @prefix veh:     &lt;http://www.example.com#&gt; .
      @prefix schema:  &lt;http://schema.org/&gt;
  
      veh:Car
            rdf:type owl:Class ;
            rdfs:label "Car"@en .
    veh:Attribute
        rdf:type owl:Class ;
        rdfs:comment "Attributes that belongs to Car"@en ;
        rdfs:label "Attribute"@en .
  
  veh:hasAttribute
            rdf:type owl:ObjectProperty ;
            rdfs:domain aml:Car ;
            rdfs:label "has Attribute"@en ;
            rdfs:range veh:Attribute .
  
      veh:hasValue
            rdf:type owl:DatatypeProperty ;
            rdfs:domain veh:Attribute ;
            rdfs:label "has Value"@en ;
            rdfs:range xsd:string .
  </code></pre>
  
  <hr>
  
  <p>So generated my RDF graph based on above mapping and got the following.:</p>
  
  <pre><code>veh:Car
    schema:name "BMW" ;
    veh:hasAttribute veh:Attribute ;
    a veh:Car .
  
  veh:Attribute
    schema:name "speed","weight" ;
    a veh:Attribute ;
    veh:hasValue "1.5", "35".
  </code></pre>
  
  <hr>
  
  <p>like what should be the query?
  my query is:</p>
  
  <pre><code>select  distinct ?name ?value
  
  from &lt;http://localhost.com/worksheets/Phd_Example&gt;
  
  where {
  ?x a veh:Car.
  ?x veh:hasAttribute ?z.
  ?z veh:hasValue ?value.
  ?z schema:name ?name.
  }   
  </code></pre>
  
  <p>but the output is not good:</p>
  
  <p>i get </p>
  
  <pre><code>speed 1.5
  weight 1.5
  speed 30
  wieght 30
  </code></pre>
  
  <p>why am i getting duplicate values? </p>
  
  <p>i want the result to be:</p>
  
  <pre><code>speed 1.5
  
  weight 30
  </code></pre>