1 6 7 package com.hp.hpl.jena.graph.query; 8 9 import java.util.Set ; 10 11 import com.hp.hpl.jena.graph.*; 12 import com.hp.hpl.jena.util.CollectionFactory; 13 14 20 public class Util 21 { 22 25 public static Set union( Set x, Set y ) 26 { 27 Set result = CollectionFactory.createHashedSet( x ); 28 result.addAll( y ); 29 return result; 30 } 31 32 36 public static Set variablesOf( Triple t ) 37 { 38 Set result = CollectionFactory.createHashedSet(); 39 addIfVariable( result, t.getSubject() ); 40 addIfVariable( result, t.getPredicate() ); 41 addIfVariable( result, t.getObject() ); 42 return result; 43 } 44 45 private static void addIfVariable( Set result, Node n ) 46 { if (n.isVariable()) result.add( n.getName() ); } 47 } 48 49 | Popular Tags |