private MGraph getConceptCacheMGraph() { MGraph conceptCacheMGraph = null; TcManager tcManager = TcManager.getInstance(); try { conceptCacheMGraph = tcManager.getMGraph(CONCEPT_CACHE_MGRAPH); } catch (NoSuchEntityException nsee) { conceptCacheMGraph = tcManager.createMGraph(CONCEPT_CACHE_MGRAPH); } return conceptCacheMGraph; }
/** * This method creates an {@link MGraph} to store concepts' descriptions * if this graph does not already exist. * * @return * an {@link MGraph} */ public MGraph getRemoteConceptsDescriptionMGraph() { MGraph remoteConceptsDescriptionMGraph = null; TcManager tcManager = TcManager.getInstance(); try { remoteConceptsDescriptionMGraph = tcManager.getMGraph(REMOTE_CONCEPTS_DESCRIPTION_MGRAPH); } catch (NoSuchEntityException nsee) { remoteConceptsDescriptionMGraph = tcManager.createMGraph(REMOTE_CONCEPTS_DESCRIPTION_MGRAPH); } return remoteConceptsDescriptionMGraph; }
public static MGraph createOntology(String id, TcManager tcm) { UriRef name = new UriRef(id); MGraph ont = tcm.createMGraph(name); ont.add(new TripleImpl(name, RDF.type, OWL.Ontology)); return ont; }
public void createEnhancementGraph() throws StoreException { final UriRef graphUri = new UriRef(Constants.ENHANCEMENTS_GRAPH_URI); MGraph enhancementGraph = null; try { enhancementGraph = tcManager.getMGraph(graphUri); String filter = String.format("(%s=%s)", "graph.uri", graphUri.getUnicodeString()); ServiceReference[] sr = bundleContext.getServiceReferences(TripleCollection.class.getName(), filter); if (sr == null) { registerEnhancementGraph(graphUri, enhancementGraph); } } catch (NoSuchEntityException e) { log.debug("Creating the enhancement graph!"); enhancementGraph = tcManager.createMGraph(graphUri); registerEnhancementGraph(graphUri, enhancementGraph); } catch (InvalidSyntaxException e) { log.error("Failed to get ServiceReference for TripleCollection"); throw new StoreException("Failed to get ServiceReference for TripleCollection", e); } }