本文整理汇总了Java中org.openrdf.rio.RDFFormat.TURTLE属性的典型用法代码示例。如果您正苦于以下问题:Java RDFFormat.TURTLE属性的具体用法?Java RDFFormat.TURTLE怎么用?Java RDFFormat.TURTLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openrdf.rio.RDFFormat
的用法示例。
在下文中一共展示了RDFFormat.TURTLE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRDFFormat
/**
* Returns an instance of {@link org.openrdf.rio.RDFFormat} for a
* given MIME-Type string.
*
* @param mimetype the MIME-Type as string
* @return the corresponding RDF-Format
*/
protected RDFFormat getRDFFormat(String mimetype) {
switch (mimetype) {
default:
case RDFMediaType.RDF_TURTLE:
return RDFFormat.TURTLE;
case RDFMediaType.RDF_YARS:
return RDFFormat.YARS;
case RDFMediaType.RDF_XML:
return RDFFormat.RDFXML;
case RDFMediaType.RDF_NTRIPLES:
return RDFFormat.NTRIPLES;
case RDFMediaType.RDF_JSON:
return RDFFormat.RDFJSON;
}
}
示例2: getRequestedAcceptHeader
public static RDFFormat getRequestedAcceptHeader(String contentType) {
RDFFormat requesetedContentType = null;
if (contentType == null || contentType.isEmpty()) {
requesetedContentType = RDFFormat.TURTLE;
}
else if (contentType.contentEquals(
RDFFormat.TURTLE.getDefaultMIMEType()) ||
contentType.contains(MediaType.ALL_VALUE)) {
requesetedContentType = RDFFormat.TURTLE;
}
else if (contentType.contentEquals(
RDFFormat.JSONLD.getDefaultMIMEType())) {
requesetedContentType = RDFFormat.JSONLD;
}
else if (contentType.contentEquals(
RDFFormat.N3.getDefaultMIMEType())) {
requesetedContentType = RDFFormat.N3;
}
else if (contentType.contentEquals(
RDFFormat.RDFXML.getDefaultMIMEType())) {
requesetedContentType = RDFFormat.RDFXML;
}
return requesetedContentType;
}
示例3: getRDF
@GET
public Response getRDF(@QueryParam("entity") String entity,
@QueryParam("topK") Integer topK,
@QueryParam("fixedProperty") String fixedProperty,
@QueryParam("language") String language,
@QueryParam("maxHops") Integer maxHops,
@HeaderParam("Accept") String outputMime)
{
RDFFormat outputFormat = Rio.getParserFormatForMIMEType(outputMime.split(",")[0]);
if (outputFormat == null) {
outputFormat = RDFFormat.TURTLE;
}
String [] fixedProperties = new String[0];
if (fixedProperty != null) {
fixedProperties = fixedProperty.split(",");
}
Response r = executeQuery(entity, topK, maxHops, fixedProperties, language, outputFormat);
return Response.fromResponse(r).status(200).header("Location", null).build();
}
示例4: parseFormat
/** Converts a command-line RDF type name into the appropriate Sesame type value. */
private static RDFFormat parseFormat(String format) {
switch(format) {
case "binary": return RDFFormat.BINARY;
case "json-ld": return RDFFormat.JSONLD;
case "n3": return RDFFormat.N3;
case "n-quads": return RDFFormat.NQUADS;
case "n-triples": return RDFFormat.NTRIPLES;
case "rdf-a": return RDFFormat.RDFA;
case "rdf-json": return RDFFormat.RDFJSON;
case "rdf-xml": return RDFFormat.RDFXML;
case "trig": return RDFFormat.TRIG;
case "trix": return RDFFormat.TRIX;
case "turtle": return RDFFormat.TURTLE;
}
return null;
}
示例5: load
/**
* Loads all triples found in the datafile associated with the given name.
*
* @param datafileName the name of the datafile.
* @param graphs an optional set of target graph URIs.
* @throws Exception hopefully never, otherwise the test fails.
*/
protected void load(final MisteryGuest data) throws Exception {
if (data.datasets == null || data.datasets.length == 0) {
return;
}
for (final String datafileName : data.datasets) {
final RDFFormat format = datafileName.endsWith(".ttl") ? RDFFormat.TURTLE : RDFFormat.RDFXML;
if (data.graphURI != null) {
localConnection.add(source(datafileName), DUMMY_BASE_URI, format, localConnection.getValueFactory().createURI(data.graphURI));
cumulusConnection.add(source(datafileName), DUMMY_BASE_URI, format, cumulusConnection.getValueFactory().createURI(data.graphURI));
} else {
localConnection.add(source(datafileName), DUMMY_BASE_URI, format);
cumulusConnection.add(source(datafileName), DUMMY_BASE_URI, format);
}
}
}
示例6: getRDFFormat
/**
* Returns the RDF format for this factory.
*/
@Override
public RDFFormat getRDFFormat() {
return RDFFormat.TURTLE;
}
示例7: getRDFFormat
/**
* Gets the RDF format that this RDFWriter uses.
*/
@Override
public RDFFormat getRDFFormat() {
return RDFFormat.TURTLE;
}
示例8: storeInRepo
public void storeInRepo(String src, String baseURI, String context, String format,
Boolean inference) throws RDFParseException, RepositoryException, IOException,
RDFHandlerException, InvalidDatasetFormatFault {
RDFFormat realFormat = null;
GeosparqlRDFHandlerBase.ENABLE_INFERENCE = inference;
if ((baseURI != null) && (baseURI.equals(""))) {
baseURI = null;
}
URI uriContext;
if ((context == null) || (context.equals(""))) {
uriContext = null;
} else {
ValueFactory f = repo.getValueFactory();
uriContext = f.createURI(context);
}
if (format.equalsIgnoreCase("N3") || format.equals(RDFFormat.N3.getName())) {
realFormat = RDFFormat.N3;
} else if (format.equalsIgnoreCase("NTRIPLES") || format.equals(RDFFormat.NTRIPLES.getName())) {
realFormat = RDFFormat.NTRIPLES;
} else if (format.equalsIgnoreCase("RDFXML") || format.equals(RDFFormat.RDFXML.getName())) {
realFormat = RDFFormat.RDFXML;
} else if (format.equalsIgnoreCase("TURTLE") || format.equals(RDFFormat.TURTLE.getName())) {
realFormat = RDFFormat.TURTLE;
} else {
throw new InvalidDatasetFormatFault();
}
try {
URL source = new URL(src);
storeURL(source, baseURI, uriContext, realFormat);
} catch (MalformedURLException e) {
URL fromClasspath = getClass().getResource(src);
if (fromClasspath != null) {
storeURL(fromClasspath, baseURI, uriContext, realFormat);
} else {
File file = new File(src);
if (file.exists()) {
storeURL(new URL("file://" + src), baseURI, uriContext, realFormat);
} else {
logger.info("File \"{}\" does not exist. Trying reading as String.", src);
storeString((String) src, baseURI, uriContext, realFormat);
}
}
}
}