public void setHasUserBehaviour(ibspan.tss.um.ontology.UserBehaviour hasUserBehaviour) throws JastorException { if (_model.contains(_resource, hasUserBehaviourProperty)) { _model.removeAll(_resource, hasUserBehaviourProperty, null); } this.hasUserBehaviour = hasUserBehaviour; if (hasUserBehaviour != null) { _model.add( _model.createStatement(_resource, hasUserBehaviourProperty, hasUserBehaviour.resource())); } }
public ibspan.tss.um.ontology.UserBehaviour setHasUserBehaviour() throws JastorException { if (_model.contains(_resource, hasUserBehaviourProperty)) { _model.removeAll(_resource, hasUserBehaviourProperty, null); } ibspan.tss.um.ontology.UserBehaviour hasUserBehaviour = ibspan.tss.um.ontology.UserModellingFactory.createUserBehaviour( _model.createResource(), _model); this.hasUserBehaviour = hasUserBehaviour; _model.add( _model.createStatement(_resource, hasUserBehaviourProperty, hasUserBehaviour.resource())); return hasUserBehaviour; }
public ibspan.tss.um.ontology.UserBehaviour setHasUserBehaviour( com.hp.hpl.jena.rdf.model.Resource resource) throws JastorException { if (!_model.contains(resource, RDF.type, ibspan.tss.um.ontology.UserBehaviour.TYPE)) throw new JastorException( "Resource " + resource + " not of type " + ibspan.tss.um.ontology.UserBehaviour.TYPE); if (_model.contains(_resource, hasUserBehaviourProperty)) { _model.removeAll(_resource, hasUserBehaviourProperty, null); } ibspan.tss.um.ontology.UserBehaviour hasUserBehaviour = ibspan.tss.um.ontology.UserModellingFactory.getUserBehaviour(resource, _model); this.hasUserBehaviour = hasUserBehaviour; _model.add( _model.createStatement(_resource, hasUserBehaviourProperty, hasUserBehaviour.resource())); return hasUserBehaviour; }
public void removedStatement(com.hp.hpl.jena.rdf.model.Statement stmt) { // if (!stmt.getSubject().equals(_resource)) // return; if (stmt.getPredicate().equals(hasContextProperty)) { if (!stmt.getObject().canAs(com.hp.hpl.jena.rdf.model.Resource.class)) return; com.hp.hpl.jena.rdf.model.Resource resource = (com.hp.hpl.jena.rdf.model.Resource) stmt.getObject().as(com.hp.hpl.jena.rdf.model.Resource.class); if (hasContext != null && hasContext.resource().equals(resource)) hasContext = null; if (listeners != null) { java.util.ArrayList consumers; synchronized (listeners) { consumers = (java.util.ArrayList) listeners.clone(); } for (java.util.Iterator iter = consumers.iterator(); iter.hasNext(); ) { ExtendedUserBehaviourListener listener = (ExtendedUserBehaviourListener) iter.next(); listener.hasContextChanged(ibspan.tss.um.ontology.ExtendedUserBehaviourImpl.this); } } return; } if (stmt.getPredicate().equals(hasUserBehaviourProperty)) { if (!stmt.getObject().canAs(com.hp.hpl.jena.rdf.model.Resource.class)) return; com.hp.hpl.jena.rdf.model.Resource resource = (com.hp.hpl.jena.rdf.model.Resource) stmt.getObject().as(com.hp.hpl.jena.rdf.model.Resource.class); if (hasUserBehaviour != null && hasUserBehaviour.resource().equals(resource)) hasUserBehaviour = null; if (listeners != null) { java.util.ArrayList consumers; synchronized (listeners) { consumers = (java.util.ArrayList) listeners.clone(); } for (java.util.Iterator iter = consumers.iterator(); iter.hasNext(); ) { ExtendedUserBehaviourListener listener = (ExtendedUserBehaviourListener) iter.next(); listener.hasUserBehaviourChanged(ibspan.tss.um.ontology.ExtendedUserBehaviourImpl.this); } } return; } }