test_class.file: core/src/test/java/edu/tuberlin/dima/textmining/jedi/core/freebase/FreebaseHelperTest.java
test_class.identifier: FreebaseHelperTest
test_case.body: @Test
  	public void testGetTypes() throws Exception {
  		FreebaseHelper freebaseHelper = new FreebaseHelper();
  
  		FreebaseRelation typesForRelationFromFreebase = freebaseHelper.getTypesForRelationFromFreebase("ns:people.person.education..education.education.degree");
  
  		Assert.assertThat(typesForRelationFromFreebase.getDomain(), is("ns:people.person"));
  		Assert.assertThat(typesForRelationFromFreebase.getRange(), is("ns:education.educational_degree"));
  
  		typesForRelationFromFreebase = freebaseHelper.getTypesForRelationFromFreebase("ns:people.person.education..education.education.institution");
  
  		Assert.assertThat(typesForRelationFromFreebase.getDomain(), is("ns:people.person"));
  		Assert.assertThat(typesForRelationFromFreebase.getRange(), is("ns:education.educational_institution"));
  
  		typesForRelationFromFreebase = freebaseHelper.getTypesForRelationFromFreebase("ns:base.rugby.rugby_club.coaches_of_this_team..base.rugby.rugby_coaching_tenure.coach");
  
  		Assert.assertThat(typesForRelationFromFreebase.getDomain(), is("ns:base.rugby.rugby_club"));
  		Assert.assertThat(typesForRelationFromFreebase.getRange(), is("ns:base.rugby.rugby_coach"));
  
  		typesForRelationFromFreebase = freebaseHelper.getTypesForRelationFromFreebase("ns:education.educational_institution.students_graduates..education.education.specialization");
  
  		Assert.assertThat(typesForRelationFromFreebase.getDomain(), is("ns:education.educational_institution"));
  		Assert.assertThat(typesForRelationFromFreebase.getRange(), is("ns:education.field_of_study"));
  
  	}
test_case.class_method_signature: FreebaseHelperTest.testGetTypes()
test_case.full_signature: @Test public void testGetTypes()
test_case.identifier: testGetTypes
test_case.invocations: getTypesForRelationFromFreebase assertThat getDomain is assertThat getRange is getTypesForRelationFromFreebase assertThat getDomain is assertThat getRange is getTypesForRelationFromFreebase assertThat getDomain is assertThat getRange is getTypesForRelationFromFreebase assertThat getDomain is assertThat getRange is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetTypes()
focal_class.declarator: FREEBASE_TOPIC_ENDPOINT = "https://www.googleapis.com/freebase/v1/topic{id}?filter=/common/topic/description&filter=/type/object/guid&filter=/type/object/type&filter=/type/object/name&filter=/common/topic/alias&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_TOPIC_ENDPOINT = "https://www.googleapis.com/freebase/v1/topic{id}?filter=/common/topic/description&filter=/type/object/guid&filter=/type/object/type&filter=/type/object/name&filter=/common/topic/alias&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_TOPIC_ENDPOINT
focal_class.declarator: FREEBASE_SEARCH_API = "https://www.googleapis.com/freebase/v1/search?limit=1&scoring=entity&query={id}&prefixed=true&output=(%2Fcommon%2Ftopic%2Fdescription+type+name+%2Fcommon%2Ftopic%2Falias)&lang=en&indent=true&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_SEARCH_API = "https://www.googleapis.com/freebase/v1/search?limit=1&scoring=entity&query={id}&prefixed=true&output=(%2Fcommon%2Ftopic%2Fdescription+type+name+%2Fcommon%2Ftopic%2Falias)&lang=en&indent=true&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_SEARCH_API
focal_class.declarator: FREEBASE_MQL_ENDPOINT = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22id%22%3A%20%22{id}%22%2C%20%22%2Fdataworld%2Fgardening_hint%2Freplaced_by%22%3A%20%5B%7B%22mid%22%3A%20null%20%7D%5D%20%7D%5D%0A%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_MQL_ENDPOINT = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22id%22%3A%20%22{id}%22%2C%20%22%2Fdataworld%2Fgardening_hint%2Freplaced_by%22%3A%20%5B%7B%22mid%22%3A%20null%20%7D%5D%20%7D%5D%0A%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_MQL_ENDPOINT
focal_class.declarator: FREEBASE_MQL_ENDPOINT_SUBRELATION_RELATION = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22mid%22%3A%20%22{id1}%22%2C%20%22{REL1}%22%3A%20%5B%7B%22{REL2}%22%3A%20%7B%22mid%22%3A%20%22{id2}%22%7D%7D%5D%7D%5D%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_MQL_ENDPOINT_SUBRELATION_RELATION = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22mid%22%3A%20%22{id1}%22%2C%20%22{REL1}%22%3A%20%5B%7B%22{REL2}%22%3A%20%7B%22mid%22%3A%20%22{id2}%22%7D%7D%5D%7D%5D%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_MQL_ENDPOINT_SUBRELATION_RELATION
focal_class.declarator: FREEBASE_MQL_ENDPOINT_RELATION = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22mid%22%3A%20%22{id1}%22%2C%20%22{REL1}%22%3A%20%5B%7B%22mid%22%3A%20%22{id2}%22%7D%5D%7D%5D%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_MQL_ENDPOINT_RELATION = "https://www.googleapis.com/freebase/v1/mqlread/?lang=%2Flang%2Fen&query=%5B%7B%20%22mid%22%3A%20%22{id1}%22%2C%20%22{REL1}%22%3A%20%5B%7B%22mid%22%3A%20%22{id2}%22%7D%5D%7D%5D%0A%0A&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_MQL_ENDPOINT_RELATION
focal_class.declarator: FREEBASE_INVERSE_RELATION = "https://www.googleapis.com/freebase/v1/topic{id}?filter=/type/property/reverse_property&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA"
focal_class.modifier: private static final
focal_class.original_string: private static final String FREEBASE_INVERSE_RELATION = "https://www.googleapis.com/freebase/v1/topic{id}?filter=/type/property/reverse_property&key=AIzaSyCyloa8DMxhKvBVdqdk_Drf900rAeeA7QA";
focal_class.type: String
focal_class.var_name: FREEBASE_INVERSE_RELATION
focal_class.declarator: MAPPER = new ObjectMapper()
focal_class.modifier: private static final
focal_class.original_string: private static final ObjectMapper MAPPER = new ObjectMapper();
focal_class.type: ObjectMapper
focal_class.var_name: MAPPER
focal_class.declarator: jfactory = new JsonFactory()
focal_class.modifier: private static final
focal_class.original_string: private static final JsonFactory jfactory = new JsonFactory();
focal_class.type: JsonFactory
focal_class.var_name: jfactory
focal_class.declarator: LOG = LoggerFactory.getLogger(FreebaseHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(FreebaseHelper.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: core/src/main/java/edu/tuberlin/dima/textmining/jedi/core/freebase/FreebaseHelper.java
focal_class.identifier: FreebaseHelper
focal_class.class_method_signature: FreebaseHelper.getURL(String metaURL)
focal_class.full_signature: private JsonNode getURL(String metaURL)
focal_class.identifier: getURL
focal_class.modifiers: private
focal_class.parameters: (String metaURL)
focal_class.return: JsonNode
focal_class.signature: JsonNode getURL(String metaURL)
focal_class.class_method_signature: FreebaseHelper.transformOldToNewId(String old)
focal_class.full_signature: public static String transformOldToNewId(String old)
focal_class.identifier: transformOldToNewId
focal_class.modifiers: public static
focal_class.parameters: (String old)
focal_class.return: String
focal_class.signature: String transformOldToNewId(String old)
focal_class.class_method_signature: FreebaseHelper.transformNewToOldId(String newId)
focal_class.full_signature: public static String transformNewToOldId(String newId)
focal_class.identifier: transformNewToOldId
focal_class.modifiers: public static
focal_class.parameters: (String newId)
focal_class.return: String
focal_class.signature: String transformNewToOldId(String newId)
focal_class.class_method_signature: FreebaseHelper.getNameForID(String id)
focal_class.full_signature: public Entity getNameForID(String id)
focal_class.identifier: getNameForID
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: Entity
focal_class.signature: Entity getNameForID(String id)
focal_class.class_method_signature: FreebaseHelper.getNameForIDs(String id)
focal_class.full_signature: public Entity getNameForIDs(String id)
focal_class.identifier: getNameForIDs
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: Entity
focal_class.signature: Entity getNameForIDs(String id)
focal_class.class_method_signature: FreebaseHelper.checkIfCompoundRelationHolds(String id1, String id2, String[] relation)
focal_class.full_signature: public boolean checkIfCompoundRelationHolds(String id1, String id2, String[] relation)
focal_class.identifier: checkIfCompoundRelationHolds
focal_class.modifiers: public
focal_class.parameters: (String id1, String id2, String[] relation)
focal_class.return: boolean
focal_class.signature: boolean checkIfCompoundRelationHolds(String id1, String id2, String[] relation)
focal_class.class_method_signature: FreebaseHelper.getInverseRelation(String relation)
focal_class.full_signature: private String getInverseRelation(String relation)
focal_class.identifier: getInverseRelation
focal_class.modifiers: private
focal_class.parameters: (String relation)
focal_class.return: String
focal_class.signature: String getInverseRelation(String relation)
focal_class.class_method_signature: FreebaseHelper.getFreebaseTopicForID(String freebaseID)
focal_class.full_signature: private JsonNode getFreebaseTopicForID(String freebaseID)
focal_class.identifier: getFreebaseTopicForID
focal_class.modifiers: private
focal_class.parameters: (String freebaseID)
focal_class.return: JsonNode
focal_class.signature: JsonNode getFreebaseTopicForID(String freebaseID)
focal_class.class_method_signature: FreebaseHelper.getTypesForRelationFromFreebase(String r)
focal_class.full_signature: public FreebaseRelation getTypesForRelationFromFreebase(String r)
focal_class.identifier: getTypesForRelationFromFreebase
focal_class.modifiers: public
focal_class.parameters: (String r)
focal_class.return: FreebaseRelation
focal_class.signature: FreebaseRelation getTypesForRelationFromFreebase(String r)
focal_class.class_method_signature: FreebaseHelper.readAllInverseRelations()
focal_class.full_signature: public void readAllInverseRelations()
focal_class.identifier: readAllInverseRelations
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void readAllInverseRelations()
focal_class.class_method_signature: FreebaseHelper.main(String[] args)
focal_class.full_signature: public static void main(String[] args)
focal_class.identifier: main
focal_class.modifiers: public static
focal_class.parameters: (String[] args)
focal_class.return: void
focal_class.signature: void main(String[] args)
focal_method.body: public FreebaseRelation getTypesForRelationFromFreebase(String r) throws IOException {
  
  		final String relation = r.replaceFirst("ns:", "");
  
  		String toAsk = relation;
  		String left = null;
  
  		boolean direct = true;
  
  		// check if we have a compound type
  		if (relation.contains("..")) {
  			// examples
  			// ns:location.location.adjoin_s..location.adjoining_relationship.adjoins	29587812
  			// ns:organization.organization.headquarters..location.mailing_address.state_province_region	2506163
  			// ns:organization.organization_member.member_of..organization.organization_membership.organization	2048109
  			toAsk = relation.substring(0, relation.indexOf(".."));
  			left = relation.substring(relation.indexOf("..") + 2);
  			direct = false;
  		}
  
  		JsonNode property;
  
  		try {
  			property = getFreebaseTopicForID(toAsk);
  		} catch (FileNotFoundException e) {
  			LOG.warn("Error", e);
  			return null;
  		}
  
  		String one;
  		String two;
  
  		if (direct) {
  
  			one = property.has("/type/property/schema") ?
  				property.get("/type/property/schema").get("values").get(0).get("id").asText() :
  				property.get("/type/object/type").get("values").get(0).get("id").asText();
  
  			two = property.has("/type/property/expected_type") ?
  				property.get("/type/property/expected_type").get("values").get(0).get("id").asText() :
  				property.get("/type/object/type").get("values").get(0).get("id").asText();
  
  
  		} else if (!property.has("/type/property/expected_type")) {
  
  			one = property.has("/type/property/schema") ?
  				property.get("/type/property/schema").get("values").get(0).get("id").asText() :
  				property.get("/type/object/type").get("values").get(0).get("id").asText();
  
  
  			// Property 2
  			final JsonNode second = getFreebaseTopicForID(left);
  
  			two = second.has("/type/property/expected_type") ?
  				second.get("/type/property/expected_type").get("values").get(0).get("id").asText() :
  				second.get("/type/object/type").get("values").get(0).get("id").asText();
  
  
  		} else {
  
  			// Property 1
  			one = property.get("/type/property/schema").get("values").get(0).get("id").asText();
  
  			// Property 2
  			JsonNode second = getFreebaseTopicForID(left);
  
  			two = second.has("/type/property/expected_type") ?
  				second.get("/type/property/expected_type").get("values").get(0).get("id").asText() :
  				second.get("/type/object/type").get("values").get(0).get("id").asText();
  
  
  			// Description
  
  
  		}
  		one = one.replaceFirst("/", "ns:").replaceAll("/", ".");
  		two = two.replaceFirst("/", "ns:").replaceAll("/", ".");
  		FreebaseRelation relDescription = new FreebaseRelation(one, two, null, null);
  		LOG.info(relDescription.toString());
  
  
  		return relDescription;
  
  	}
focal_method.class_method_signature: FreebaseHelper.getTypesForRelationFromFreebase(String r)
focal_method.full_signature: public FreebaseRelation getTypesForRelationFromFreebase(String r)
focal_method.identifier: getTypesForRelationFromFreebase
focal_method.invocations: replaceFirst contains substring indexOf substring indexOf getFreebaseTopicForID warn has asText get get get get asText get get get get has asText get get get get asText get get get get has has asText get get get get asText get get get get getFreebaseTopicForID has asText get get get get asText get get get get asText get get get get getFreebaseTopicForID has asText get get get get asText get get get get replaceAll replaceFirst replaceAll replaceFirst info toString
focal_method.modifiers: public
focal_method.parameters: (String r)
focal_method.return: FreebaseRelation
focal_method.signature: FreebaseRelation getTypesForRelationFromFreebase(String r)