nodes: 0, module; 1, function_definition; 2, function_name:entityTriples; 3, parameters; 4, block; 5, identifier:rdfGraph; 6, identifier:anEntity; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# extract predicate/object; 14, for_statement; 15, comment:# sorting; 16, if_statement; 17, comment:# if niceURI:; 18, comment:#	temp = [(uri2niceString(ontology, y), z) for y,z in temp]; 19, return_statement; 20, identifier:excludeProps; 21, False; 22, identifier:excludeBNodes; 23, False; 24, identifier:orderProps; 25, list; 26, comment:"""
      Returns the pred-obj for any given resource, excluding selected ones..
  
      Sorting: by default results are sorted alphabetically and according to namespaces: [RDF, RDFS, OWL.OWLNS, DC.DCNS]
      """; 27, assignment; 28, not_operator; 29, block; 30, pattern_list; 31, call; 32, block; 33, comparison_operator:type(orderProps) == type([]); 34, block; 35, elif_clause; 36, identifier:temp; 37, identifier:RDF; 38, identifier:RDFS; 39, attribute; 40, attribute; 41, identifier:temp; 42, list; 43, identifier:excludeProps; 44, expression_statement; 45, identifier:x; 46, identifier:y; 47, identifier:z; 48, attribute; 49, argument_list; 50, if_statement; 51, if_statement; 52, call; 53, call; 54, expression_statement; 55, comment:# order props only; 56, expression_statement; 57, comment:# create form: [(1, 'something'),(2,'bobby'),(3,'suzy'),(4,'crab')]; 58, expression_statement; 59, comment:# create dict to pass to sorted procedure; 60, expression_statement; 61, identifier:orderProps; 62, comment:# default to alpha sorting unless False; 63, block; 64, identifier:OWL; 65, identifier:OWLNS; 66, identifier:DC; 67, identifier:DCNS; 68, assignment; 69, identifier:rdfGraph; 70, identifier:triples; 71, tuple; 72, boolean_operator; 73, block; 74, comparison_operator:y not in excludeProps; 75, block; 76, identifier:type; 77, argument_list; 78, identifier:type; 79, argument_list; 80, assignment; 81, assignment; 82, assignment; 83, assignment; 84, expression_statement; 85, identifier:excludeProps; 86, list; 87, identifier:anEntity; 88, None; 89, None; 90, identifier:excludeBNodes; 91, call; 92, continue_statement; 93, identifier:y; 94, identifier:excludeProps; 95, expression_statement; 96, identifier:orderProps; 97, list; 98, identifier:orderedUris; 99, call; 100, identifier:orderedUris; 101, list_comprehension; 102, identifier:rank; 103, call; 104, identifier:temp; 105, call; 106, assignment; 107, identifier:isBlankNode; 108, argument_list; 109, augmented_assignment; 110, identifier:sortByNamespacePrefix; 111, argument_list; 112, tuple; 113, for_in_clause; 114, identifier:dict; 115, generator_expression; 116, identifier:sorted; 117, argument_list; 118, identifier:temp; 119, call; 120, identifier:z; 121, identifier:temp; 122, list; 123, list_comprehension; 124, identifier:orderProps; 125, binary_operator:n + 1; 126, identifier:x; 127, pattern_list; 128, call; 129, tuple; 130, for_in_clause; 131, identifier:temp; 132, keyword_argument; 133, identifier:sorted; 134, argument_list; 135, tuple; 136, identifier:y; 137, for_in_clause; 138, identifier:n; 139, integer:1; 140, identifier:n; 141, identifier:x; 142, identifier:enumerate; 143, argument_list; 144, identifier:key; 145, identifier:rank; 146, tuple_pattern; 147, identifier:orderedUris; 148, identifier:key; 149, lambda; 150, identifier:temp; 151, keyword_argument; 152, identifier:y; 153, identifier:z; 154, pattern_list; 155, identifier:temp; 156, identifier:orderedUris; 157, identifier:rank; 158, identifier:key; 159, lambda_parameters; 160, call; 161, identifier:key; 162, lambda; 163, identifier:y; 164, identifier:z; 165, identifier:tup; 166, attribute; 167, argument_list; 168, lambda_parameters; 169, subscript; 170, identifier:rank; 171, identifier:get; 172, subscript; 173, identifier:tup; 174, identifier:tup; 175, integer:0; 176, identifier:tup; 177, integer:0
code: def entityTriples(rdfGraph, anEntity, excludeProps=False, excludeBNodes=False,
                    orderProps=[RDF, RDFS, OWL.OWLNS, DC.DCNS]):
      """
      Returns the pred-obj for any given resource, excluding selected ones..
  
      Sorting: by default results are sorted alphabetically and according to namespaces: [RDF, RDFS, OWL.OWLNS, DC.DCNS]
      """
      temp = []
      if not excludeProps:
          excludeProps = []
  
      # extract predicate/object
      for x, y, z in rdfGraph.triples((anEntity, None, None)):
          if excludeBNodes and isBlankNode(z):
              continue
          if y not in excludeProps:
              temp += [(y, z)]
  
      # sorting
      if type(orderProps) == type([]):
          orderedUris = sortByNamespacePrefix([y for y, z in temp], orderProps)  # order props only
          orderedUris = [(n + 1, x) for n, x in
                         enumerate(orderedUris)]  # create form: [(1, 'something'),(2,'bobby'),(3,'suzy'),(4,'crab')]
          rank = dict((key, rank) for (rank, key) in orderedUris)  # create dict to pass to sorted procedure
          temp = sorted(temp, key=lambda tup: rank.get(tup[0]))
      elif orderProps:  # default to alpha sorting unless False
          temp = sorted(temp, key=lambda tup: tup[0])
  
      # if niceURI:
      #	temp = [(uri2niceString(ontology, y), z) for y,z in temp]
  
      return temp