I want to count how many times the foaf:account property is used(SPARQL)

I want to write a SPARQL query to count how many times the foaf:account property is used and how to execute it in Java.

Can someone help me please?

In this case, i want the SPARQL query to return "2".


         xmlns:foaf="http://xmlns.com/foaf/0.1/">   
         <foaf:Person rdf:about="https://someone">     
         <foaf:lastName>Surname</foaf:lastName>   
         <foaf:account>https://www.acc1.com</foaf:account>   
         <foaf:account>https://www.acc2.com</foaf:account> 
         <foaf:weblog>https://smth</foaf:weblog>   
        </foaf:Person>  
</rdf:RDF><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

Best Answer