Java Code Examples for org.apache.jena.riot.Lang#TURTLE

The following examples show how to use org.apache.jena.riot.Lang#TURTLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UndefinedSubjectValidator.java    From rdflint with MIT License 6 votes vote down vote up
@Override
public void setParameters(RdfLintParameters params) {
  super.setParameters(params);

  List<Map<String, String>> paramList = getValidationParameterMapList();
  for (Map<String, String> map : paramList) {
    String url = map.get("url");
    String startswith = map.get("startswith");
    String langtype = map.get("langtype");

    // skip loaded url
    if (additionalUrlSubjectsMap.get(url) != null) {
      additionalStartswithSubjectsMap.put(startswith, additionalUrlSubjectsMap.get(url));
      continue;
    }
    Lang lang = Lang.TURTLE;
    if ("rdfxml".equalsIgnoreCase(langtype) || "rdf".equalsIgnoreCase(langtype)) {
      lang = Lang.RDFXML;
    }
    Set<String> sets = loadSubjects(RDFParser.source(url), startswith, lang);
    if (sets != null) {
      additionalStartswithSubjectsMap.put(startswith, sets);
      additionalUrlSubjectsMap.put(url, sets);
    }
  }
}
 
Example 2
Source File: LangUtils.java    From hypergraphql with Apache License 2.0 5 votes vote down vote up
public static Lang forName(final String rdfFormat) {

        final String ucRdfFormat = rdfFormat.toUpperCase();
        switch(ucRdfFormat) {

            case "N3":
            case "TTL":
            case "TURTLE":
                return Lang.TURTLE;
            case "NT":
            case "NTRIPLES":
                return Lang.NTRIPLES;
            case "NQ":
            case "NQUADS":
                return Lang.NQUADS;
            case "TRIG":
                return Lang.TRIG;
            case "TRIX":
                return Lang.TRIX;
            case "RDFXML":
                return Lang.RDFXML;
            case "RDFJSON":
                return Lang.RDFJSON;
            case "JSONLD":
            case "JSON-LD":
            case "LD+JSON":
                return Lang.JSONLD;
            default:
                throw new RuntimeException(rdfFormat + " is not currently supported");
        }
    }
 
Example 3
Source File: RdflintParserBuilder.java    From rdflint with MIT License 5 votes vote down vote up
/**
 * Build RdflintParser from path.
 */
public RdflintParserBuilder source(Path path) throws IOException {
  this.lang = path.toString().endsWith(".ttl") ? Lang.TURTLE : Lang.RDFXML;
  this.body = Files.lines(path, StandardCharsets.UTF_8)
      .collect(Collectors.joining(System.getProperty("line.separator")));
  return this;
}