0

I'm trying to get the name of the individuals of a specific type so that i get them in a list for later use . I tried this and the result is in the form of an URI . How o I get for example for

( ?name = <http://www.semanticweb.org/muna/ontologies/2017/2/untitled-ontology-9#Boucles_geometrique> )

Boucles geometrique  //as it is the name of the individual . 

That is what I tried and it dont work .

String queryString = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
                + "PREFIX owl: <http://www.w3.org/2002/07/owl#> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
                + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "

                + "PREFIX S: <http://www.semanticweb.org/muna/ontologies/2017/2/untitled-ontology-9#> " +

        " SELECT ?name {?name rdf:type S:Mode } ";

Knowing that those individuals , have "HasName" data property .

  • I told you in your previous question that this was already asked and answered here. Next time, please use the search! Topic will be closed. And for your case, add another triple pattern that retrieves the `hasName` value. – UninformedUser Mar 19 '17 at 13:19
  • Possible duplicate of [Why does my SPARQL query return the URI of a resource instead of its name?](http://stackoverflow.com/questions/28479394/why-does-my-sparql-query-return-the-uri-of-a-resource-instead-of-its-name) – UninformedUser Mar 19 '17 at 13:19
  • @AKSW I used the search and I have tried it all , I'm using jena for a model , and extracting information from an ontology not dbpedia , and it didnt work . –  Mar 19 '17 at 14:52
  • @AKSW and I knew how to add the triple pattern to reteive the Hasname value , I would not have asked the question I guess . –  Mar 19 '17 at 14:56
  • Adding a triple pattern is just reading any SPARQL tutorial...`SELECT ?name {?s rdf:type S:Mode . ?s S:HasName ?name }` – UninformedUser Mar 19 '17 at 15:21
  • @AKSW Thank You , it has worked now –  Mar 19 '17 at 16:37

0 Answers0