original_docstring: All triples with node as subject.
docstring: All triples with node as subject.
docstring_tokens: All triples with node as subject .
code: def rdfGetTriples(id):
  	"""All triples with node as subject."""
  	targets = []
  	fullId = id
  
  #	log.info("rdfgetTriples(%s)" % fullId)
  	if	':' in id: #Includes full path or namespaces
  		fullId = id
  	else:
  		fullId = VOCAB + "/" + id
  	source = URIRef(fullId)
  	#log.info("rdfgetTriples(%s)" % source)
  	
  	first = True
  	unit = None
  	
  	homeSetTo = None
  	typeOfInLayers = []
  
  	try:
  		ROWSLOCK.acquire()
  		res = list(STORE.query(GETTRIPS, initBindings={'sub':source}))
  	finally:
  		ROWSLOCK.release()
  		
  	for row in res:
  #		if source == "http://meta.schema.org/":
  #		log.info("Triple: %s %s %s %s" % (source, row.p, row.o, row.g))
  		layer = str(getRevNss(str(row.g)))
  		if first:
  			first = False
  			unit = api.Unit.GetUnitNoLoad(id,True)
  		s = stripID(source)
  		p = stripID(row.p)
  		if p == "rdf:type": 
  			typeOfInLayers.append(layer)
  		elif(p == "isPartOf"):
  			if(unit.home != None and unit.home != layer):
  				log.info("WARNING Cannot set %s home to %s - already set to: %s" % (s,layer,unit.home))
  			unit.home = layer
  			homeSetTo = layer
  		elif(p == "category"):
  			unit.category = row.o
  
  		prop = api.Unit.GetUnit(p,True)
  
  		if isinstance(row.o,rdflib.Literal):
  			api.Triple.AddTripleText(unit, prop, row.o, layer)
  		else: 
  			api.Triple.AddTriple(unit, prop, api.Unit.GetUnit(stripID(row.o),True), layer)
  			
  	""" Default Unit.home to core if not specificly set with an 'isPartOf' triple """
  	if(unit and homeSetTo == None):
  		if('core' in typeOfInLayers or len(typeOfInLayers) == 0):
  			unit.home = 'core'
  		else:
  			log.info("WARNING: %s defined in extensions %s but has no 'isPartOf' triple - cannot default home to core!" % (id,typeOfInLayers))
  	return unit
code_tokens: def rdfGetTriples ( id ) : targets = [ ] fullId = id if ':' in id : fullId = id else : fullId = VOCAB + "/" + id source = URIRef ( fullId ) first = True unit = None homeSetTo = None typeOfInLayers = [ ] try : ROWSLOCK . acquire ( ) res = list ( STORE . query ( GETTRIPS , initBindings = { 'sub' : source } ) ) finally : ROWSLOCK . release ( ) for row in res : layer = str ( getRevNss ( str ( row . g ) ) ) if first : first = False unit = api . Unit . GetUnitNoLoad ( id , True ) s = stripID ( source ) p = stripID ( row . p ) if p == "rdf:type" : typeOfInLayers . append ( layer ) elif ( p == "isPartOf" ) : if ( unit . home != None and unit . home != layer ) : log . info ( "WARNING Cannot set %s home to %s - already set to: %s" % ( s , layer , unit . home ) ) unit . home = layer homeSetTo = layer elif ( p == "category" ) : unit . category = row . o prop = api . Unit . GetUnit ( p , True ) if isinstance ( row . o , rdflib . Literal ) : api . Triple . AddTripleText ( unit , prop , row . o , layer ) else : api . Triple . AddTriple ( unit , prop , api . Unit . GetUnit ( stripID ( row . o ) , True ) , layer ) """ Default Unit.home to core if not specificly set with an 'isPartOf' triple """ if ( unit and homeSetTo == None ) : if ( 'core' in typeOfInLayers or len ( typeOfInLayers ) == 0 ) : unit . home = 'core' else : log . info ( "WARNING: %s defined in extensions %s but has no 'isPartOf' triple - cannot default home to core!" % ( id , typeOfInLayers ) ) return unit
short_docstring: All triples with node as subject.
short_docstring_tokens: All triples with node as subject .
comment: """All triples with node as subject."""$SEP$#	log.info("rdfgetTriples(%s)" % fullId)$SEP$#Includes full path or namespaces$SEP$#log.info("rdfgetTriples(%s)" % source)$SEP$#		if source == "http://meta.schema.org/":$SEP$#		log.info("Triple: %s %s %s %s" % (source, row.p, row.o, row.g))$SEP$""" Default Unit.home to core if not specificly set with an 'isPartOf' triple """