本文整理汇总了Java中org.openrdf.model.util.GraphUtilException类的典型用法代码示例。如果您正苦于以下问题:Java GraphUtilException类的具体用法?Java GraphUtilException怎么用?Java GraphUtilException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphUtilException类属于org.openrdf.model.util包,在下文中一共展示了GraphUtilException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
@Override
/**
* parse graph representation of config
*
* @Note - Graph is deprecating soon (in Sesame) to be replaced by Model
*/
public void parse(Graph graph, Resource implNode)
throws RepositoryConfigException {
super.parse(graph, implNode);
try {
URI uri = GraphUtil.getOptionalObjectURI(graph, implNode, QUERY_ENDPOINT);
if (uri != null) {
setQueryEndpointUrl(uri.stringValue());
}
uri = GraphUtil.getOptionalObjectURI(graph, implNode, UPDATE_ENDPOINT);
if (uri != null) {
setUpdateEndpointUrl(uri.stringValue());
}
} catch (GraphUtilException e) {
throw new RepositoryConfigException(e.getMessage(), e);
}
}
示例2: updateMetadataGraph
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
private void updateMetadataGraph(INamedGraphWithMetaData graph, File metaGraphFile) throws AnzoIoException {
INamedGraph metaGraph = null ;
try {
metaGraph = graph.getMetaDataGraph() ;
Graph metaFile = loadGraph(metaGraphFile) ;
URI newAcl = GraphUtil.getUniqueObjectURI(metaFile, graph.getNamedGraphUri(), uri(AnzoPredicates.USES_ACL)) ;
AnzoFactory.createACL(newAcl, metaGraph) ;
Iterator<Statement> acl = metaFile.match(newAcl, null, null) ;
while (acl.hasNext()) {
metaGraph.add(acl.next()) ;
}
metaGraph.add(graph.getNamedGraphUri(), uri(AnzoPredicates.USES_ACL), newAcl) ;
} catch (GraphUtilException e) {
throw new AnzoIoException("Unable to retrieve new ACL from meta graph file: " + metaGraphFile.getPath() + ".", e) ;
} finally {
if (metaGraph == null) {
metaGraph.close() ;
}
}
}
示例3: parse
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
@Override
public void parse(final Graph graph, final Resource implNode) throws SailConfigException {
super.parse(graph, implNode);
System.out.println("parsing");
try {
final Literal userLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, USER);
if (userLit != null) {
setUser(userLit.getLabel());
}
final Literal pwdLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, PASSWORD);
if (pwdLit != null) {
setPassword(pwdLit.getLabel());
}
final Literal instLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, INSTANCE);
if (instLit != null) {
setInstance(instLit.getLabel());
}
final Literal zooLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, ZOOKEEPERS);
if (zooLit != null) {
setZookeepers(zooLit.getLabel());
}
final Literal mockLit = GraphUtil.getOptionalObjectLiteral(graph, implNode, IS_MOCK);
if (mockLit != null) {
setMock(Boolean.parseBoolean(mockLit.getLabel()));
}
} catch (final GraphUtilException e) {
throw new SailConfigException(e.getMessage(), e);
}
}
示例4: parse
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
@Override
public void parse(Graph graph, Resource implNode) throws RepositoryConfigException
{
super.parse(graph, implNode);
try {
Literal configPath = GraphUtil.getOptionalObjectLiteral(graph, implNode, SEMANTIKA_CONFIG_PATH);
if (configPath != null) {
setConfigurationPath(configPath.getLabel());
}
}
catch (GraphUtilException e) {
throw new RepositoryConfigException(e);
}
}
示例5: generate
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
public void generate(OutputStream outputStream) throws GenerationException, IOException, GraphUtilException {
String cName = getName();
if (StringUtils.isBlank(cName)) {
throw new GenerationException("could not detect name, please set explicitly");
}
//noinspection ConstantConditions
cName = WordUtils.capitalize(cName.replaceAll("\\W+", " ")).replaceAll("\\s+", "");
generate(cName, new PrintWriter(outputStream));
}
示例6: getFirstExistingObjectLiteral
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
private Literal getFirstExistingObjectLiteral(Model model, Resource subject, String lang, URI... predicates) throws GraphUtilException {
for (URI predicate : predicates) {
Literal literal = getOptionalObjectLiteral(model, subject, predicate, lang);
if (literal != null) {
return literal;
}
}
return null;
}
示例7: getPotUri
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
/**
* @param potUriMap
* @param plantId
* @param nextProjectID
* @param nextTrayURI
* @return
* @throws PoddClientException
* @throws GraphUtilException
*/
private URI getPotUri(final ConcurrentMap<String, ConcurrentMap<URI, URI>> potUriMap, final String plantId,
final InferredOWLOntologyID nextProjectID, final URI nextTrayURI) throws PoddClientException,
GraphUtilException
{
URI nextPotURI;
if(potUriMap.containsKey(plantId))
{
nextPotURI = potUriMap.get(plantId).keySet().iterator().next();
}
else
{
final Model plantIdSparqlResults =
this.doSPARQL(String.format(ExampleSpreadsheetConstants.TEMPLATE_SPARQL_BY_TYPE_LABEL_STRSTARTS,
RenderUtils.escape(plantId), RenderUtils.getSPARQLQueryString(PODD.PODD_SCIENCE_POT)),
Arrays.asList(nextProjectID));
if(plantIdSparqlResults.isEmpty())
{
this.log.debug(
"Could not find an existing container for pot barcode, assigning a temporary URI: {} {}",
plantId, nextProjectID);
nextPotURI =
RestletPoddClientImpl.vf.createURI(RestletPoddClientImpl.TEMP_UUID_PREFIX + "pot:"
+ UUID.randomUUID().toString());
}
else
{
nextPotURI = GraphUtil.getUniqueSubjectURI(plantIdSparqlResults, RDF.TYPE, PODD.PODD_SCIENCE_POT);
}
ConcurrentMap<URI, URI> nextPotUriMap = new ConcurrentHashMap<>();
final ConcurrentMap<URI, URI> putIfAbsent2 = potUriMap.putIfAbsent(plantId, nextPotUriMap);
if(putIfAbsent2 != null)
{
nextPotUriMap = putIfAbsent2;
}
nextPotUriMap.put(nextPotURI, nextTrayURI);
}
return nextPotURI;
}
示例8: getTrayUri
import org.openrdf.model.util.GraphUtilException; //导入依赖的package包/类
/**
* @param trayUriMap
* @param trayId
* @param nextProjectID
* @param nextExperimentUri
* @return
* @throws PoddClientException
* @throws GraphUtilException
*/
private URI getTrayUri(final ConcurrentMap<String, ConcurrentMap<URI, URI>> trayUriMap, final String trayId,
final InferredOWLOntologyID nextProjectID, final URI nextExperimentUri) throws PoddClientException,
GraphUtilException
{
// Check whether trayId already has an assigned URI
URI nextTrayURI;
if(trayUriMap.containsKey(trayId))
{
nextTrayURI = trayUriMap.get(trayId).keySet().iterator().next();
}
else
{
final Model trayIdSparqlResults =
this.doSPARQL(String.format(ExampleSpreadsheetConstants.TEMPLATE_SPARQL_BY_TYPE_LABEL_STRSTARTS,
RenderUtils.escape(trayId), RenderUtils.getSPARQLQueryString(PODD.PODD_SCIENCE_TRAY)),
Arrays.asList(nextProjectID));
if(trayIdSparqlResults.isEmpty())
{
this.log.debug(
"Could not find an existing container for tray barcode, assigning a temporary URI: {} {}",
trayId, nextProjectID);
nextTrayURI =
RestletPoddClientImpl.vf.createURI(RestletPoddClientImpl.TEMP_UUID_PREFIX + "tray:"
+ UUID.randomUUID().toString());
}
else
{
nextTrayURI = GraphUtil.getUniqueSubjectURI(trayIdSparqlResults, RDF.TYPE, PODD.PODD_SCIENCE_TRAY);
}
ConcurrentMap<URI, URI> nextTrayUriMap = new ConcurrentHashMap<>();
final ConcurrentMap<URI, URI> putIfAbsent2 = trayUriMap.putIfAbsent(trayId, nextTrayUriMap);
if(putIfAbsent2 != null)
{
nextTrayUriMap = putIfAbsent2;
}
nextTrayUriMap.put(nextTrayURI, nextExperimentUri);
}
return nextTrayURI;
}