@Override public void leaveCriticalSection() { inner.leaveCriticalSection(); }
@Override public void leaveCriticalSection() { holder.getBaseItem().leaveCriticalSection(); }
public boolean usesGroup(Model model, Resource theClassGroup) throws IOException { model.enterCriticalSection(Lock.READ); try { return (model.contains((Resource) null, inClassGroupProp, theClassGroup)); } finally { model.leaveCriticalSection(); } }
/** * Get a list of statements from this model that match this pattern. */ public List<Statement> matchStatementsFromModel(Model m) { m.enterCriticalSection(Lock.READ); try { return m.listStatements(subject, predicate, object).toList(); } finally { m.leaveCriticalSection(); } }
public NeedState getNeedState() { Model sysInfoModel = getSysInfoModel(); sysInfoModel.enterCriticalSection(true); RDFNode state = RdfUtils.findOnePropertyFromResource(sysInfoModel, getNeedNode(NeedGraphType.SYSINFO), WON.IS_IN_STATE); sysInfoModel.leaveCriticalSection(); if (state.equals(WON.NEED_STATE_ACTIVE)) { return NeedState.ACTIVE; } else { return NeedState.INACTIVE; } }
private void renamePortal(Resource portal, String namespace, Model model) { model.enterCriticalSection(Lock.WRITE); try { ResourceUtils.renameResource(portal, namespace + portal.getLocalName()); } finally { model.leaveCriticalSection(); } }
private List<Resource> getPortal1s(Model model) { List<Resource> portals = new ArrayList<Resource>(); try { model.enterCriticalSection(Lock.READ); ResIterator portalIt = model.listResourcesWithProperty( RDF.type, PORTAL); while (portalIt.hasNext()) { Resource portal = portalIt.nextResource(); if ("portal1".equals(portal.getLocalName())) { portals.add(portal); } } } finally { model.leaveCriticalSection(); } return portals; }
public ActionResult handleAction(Individual actionInd) { if (instanceOf(actionInd,WorkflowOntology.ClearModelAction)) { Model sourceModel = getModel(actionInd.getPropertyValue(WorkflowOntology.sourceModel)); sourceModel.enterCriticalSection(Lock.WRITE); try{ // this method is used so that any listeners can see each statement removed sourceModel.removeAll((Resource)null,(Property)null,(RDFNode)null); } finally { sourceModel.leaveCriticalSection(); } return new ActionResultImpl(); } else { return null; } } }
private List<Map<String, String>> executeQuery(Query query, Model model) { model.enterCriticalSection(Lock.READ); try{ QueryExecution qexec= QueryExecutionFactory.create(query, model ); ResultSet results = qexec.execSelect(); try{ return parseResults(results); }finally{ qexec.close(); } }finally{ model.leaveCriticalSection(); } }
@Override public void run() { for ( int i = 0 ; i < 2 ; i++ ) { try { model.enterCriticalSection(readLock) ; if ( readLock ) readOperation(false) ; else writeOperation(false) ; } finally { model.leaveCriticalSection() ; } } } }
@Override public void run() { for ( int i = 0 ; i < 2 ; i++ ) { try { model.enterCriticalSection(readLock) ; if ( readLock ) readOperation(false) ; else writeOperation(false) ; } finally { model.leaveCriticalSection() ; } } } }
/** * Gets the requiredActions directly associated with page. */ public List<String> getRequiredActions(String pageUri){ QuerySolutionMap initialBindings = new QuerySolutionMap(); initialBindings.add("pageUri", ResourceFactory.createResource(pageUri)); List<String> actions = new ArrayList<String>(); Model dModel = getOntModelSelector().getDisplayModel(); dModel.enterCriticalSection(false); try{ QueryExecution qe = QueryExecutionFactory.create( requiredActionsQuery, dModel, initialBindings); actions = executeQueryToList( qe ); qe.close(); }finally{ dModel.leaveCriticalSection(); } return actions; }
@Override public void run() { for (int i = 0; i < 2; i++) { try { lockModel.enterCriticalSection(readLock); if (readLock) readOperation(false); else writeOperation(false); } finally { lockModel.leaveCriticalSection(); } } } }
private Model executeSparqlConstruct(Model model, String sparql, boolean lock) { Query query = QueryFactory.create(sparql); try(QueryExecution queryExec = QueryExecutionFactory.create(query, model)) { model.enterCriticalSection(lock); try { return queryExec.execConstruct() ; } finally { model.leaveCriticalSection() ; } } }
@Override public void run() { for (int i = 0; i < 2; i++) { try { lockModel.enterCriticalSection(readLock); if (readLock) readOperation(false); else writeOperation(false); } finally { lockModel.leaveCriticalSection(); } } } }
private ResultSetRewindable executeSparqlSelect(Model model, String sparql, boolean lock) { Query query = QueryFactory.create(sparql); try(QueryExecution queryExec = QueryExecutionFactory.create(query, model)) { model.enterCriticalSection(lock); try { return ResultSetFactory.makeRewindable(queryExec.execSelect()); } finally { model.leaveCriticalSection(); } } }
public static boolean includeInLinkedData(Resource object, Model contextModel) { boolean retval = false; contextModel.enterCriticalSection(Lock.READ); try { StmtIterator iter = contextModel.listStatements(object, RDF.type, (RDFNode)null); while (iter.hasNext()) { Statement stmt = iter.next(); if (stmt.getObject().isResource() && contextModel.contains(stmt.getObject().asResource(), extendedLinkedDataProperty, xsdTrue)) { retval = true; break; } } } finally { contextModel.leaveCriticalSection(); } return retval; }
private Model getLabelAndTypes(Individual entity, Model ontModel, Model newModel){ for( VClass vclass : entity.getVClasses()){ newModel.add(newModel.getResource(entity.getURI()), RDF.type, newModel.getResource(vclass.getURI())); } ontModel.enterCriticalSection(Lock.READ); try { newModel.add(ontModel.listStatements(ontModel.getResource(entity.getURI()), RDFS.label, (RDFNode)null)); } finally { ontModel.leaveCriticalSection(); } return newModel; }
private void doSmushSingleModel(VitroRequest vreq) { OntModel source = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); String[] sourceModel = vreq.getParameterValues("sourceModelName"); for (String aSourceModel : sourceModel) { Model m = getModel(aSourceModel, vreq); source.addSubModel(m); } Model destination = getModel(vreq.getParameter("destinationModelName"),vreq); String propertyURIStr = vreq.getParameter("propertyURI"); Property prop = ResourceFactory.createProperty(propertyURIStr); JenaIngestUtils utils = new JenaIngestUtils(); destination.enterCriticalSection(Lock.WRITE); try { destination.add(utils.smushResources(source, prop)); } finally { destination.leaveCriticalSection(); } }
public ActionResult handleAction(Individual actionInd) { if (instanceOf(actionInd,WorkflowOntology.SmushResourcesAction)) { OntModel sourceModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); for (RDFNode node : (List<RDFNode>) actionInd.listPropertyValues(WorkflowOntology.sourceModel).toList()) { sourceModel.addSubModel(getModel(node)); } Model destinationModel = getModel(actionInd.getPropertyValue(WorkflowOntology.destinationModel)); String smushPropertyURI = getValue(actionInd.getPropertyValue(WorkflowOntology.smushOnProperty)).getLexicalForm(); destinationModel.enterCriticalSection(Lock.WRITE); try { destinationModel.add(utils.smushResources(sourceModel, ResourceFactory.createProperty(smushPropertyURI))); } finally { destinationModel.leaveCriticalSection(); } return new ActionResultImpl(); } return null; } }