Package org.apache.clerezza.rdf.core.sparql

Examples of org.apache.clerezza.rdf.core.sparql.QueryParser


    return this.selectedScheme;
  }

  @Override
  public Graph retrieveConcepts(String searchTerm) {
    QueryParser queryParser = QueryParser.getInstance();

    String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#> " +
        "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
        "PREFIX skos: <http://www.w3.org/2008/05/skos#> " +
        "CONSTRUCT {?concept a skos:Concept; skos:prefLabel ?prefLabel; " +
        "rdfs:comment ?comment; owl:sameAs ?sameConcept .} " +
        "WHERE {?concept skos:inScheme " + selectedScheme.toString() +
        "; skos:prefLabel ?prefLabel . " +
        "OPTIONAL { ?concept skos:altLabel ?altLabel .} " +
        "OPTIONAL { ?concept rdfs:comment ?comment .} " +
        "OPTIONAL { ?concept owl:sameAs ?sameConcept .} " +
        "FILTER (REGEX(STR(?prefLabel), '" +
        searchTerm + "', 'i') || REGEX(STR(?altLabel), '" +
        searchTerm + "', 'i'))}";

    ConstructQuery constructQuery;
    try {
      constructQuery = (ConstructQuery) queryParser.parse(query);
    } catch (ParseException ex) {
      throw new RuntimeException(ex);
    }

    MGraph defaultGraph = contentGraphProvider.getContentGraph();
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.sparql.QueryParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.