Difference between revisions of "XSearchLink Specification"

From D4Science Wiki
Jump to: navigation, search
(The 'Entity' Class)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
This is a '''draft''' specification of X-Link.
 +
 +
Client examples (Java code) of how to use X-Link can be found here:
 +
https://gcube.wiki.gcube-system.org/gcube/index.php/X-Link
 +
 
= Client Example =
 
= Client Example =
  
Line 90: Line 95:
 
= The 'Category' Class =
 
= The 'Category' Class =
  
void setCategoryName (String name);
+
void setName (String name);
  
void setCategoryEndpoint (Endpoint endpoint);
+
void setEndpoint (Endpoint endpoint);
  
void setCategoryTemplateQuery (TemplateQuery template);
+
void setTemplateQuery (TemplateQuery template);
  
void setCategoryNamedEntities (Set<Entity> entities);
+
void setNamedEntities (Set<Entity> entities);
  
void setCategoryResourceClass (URI resourceClass);
+
void setResourceClass (URI resourceClass);
  
void addCategoryNamedEntity (Entity entity);
+
void addNamedEntity (Entity entity);
  
String getCategoryName ();
+
String getName ();
 
+
Endpoint getCategoryEndpoint ();
+
  
TemplateQuery getCategoryTemplateQuery ();
+
Endpoint getEndpoint ();
  
Set<Entity> getCategoryNamedEntities ();  
+
TemplateQuery getTemplateQuery ();
  
URI getCategoryResourceClass ();
+
Set<Entity> getNamedEntities ();  
  
 +
URI getResourceClass ();
  
 
= The 'EntityMiningComponent' Class =
 
= The 'EntityMiningComponent' Class =
Line 131: Line 135:
  
  
= The 'XSearchLink' Class =
+
= The 'XLink' Class =
  
 
void setEntityMiningComponent ();
 
void setEntityMiningComponent ();
  
Set<Entity> retrieveEntities (Document document, Set<String> acceptedCategoryNames);
+
void retrieveEntities (String content, HashSet<String> acceptedCategoryNames);
 +
 
 +
void matchEntities ();
 +
 
 +
File storeMatchings (String filename);
 +
 
 +
void storeMatchings (File folder, String filename);
 +
 
 +
void retrieveIncomingProperties ();
 +
 
 +
void retrieveOutcomingProperties ();
 +
 
 +
void retrieveAllProperties ();
 +
 
 +
ArrayList<Entity> getEntities ();

Latest revision as of 13:29, 18 February 2014

This is a draft specification of X-Link.

Client examples (Java code) of how to use X-Link can be found here: https://gcube.wiki.gcube-system.org/gcube/index.php/X-Link

Client Example

EntityMiningComponent emc = new GateEntityMiningComponent("component_path_folder");

emc.startup(); // load entity mining tool, the categories that already exist, etc.

emc.printAvailableCategories();


XLink xlink = new XLink();

xlink.setEntityMiningComponent(emc);


HashSet<String> acceptedCategoryNames = new HashSet<String>(); acceptedCategoryNames.add("Species"); acceptedCategoryNames.add("WaterAreas");


TextExtractor extractor = new WebPageTextExtractor("http://en.wikipedia.org/wiki/Fisheries"); String content = extractor.extractText();


xlink.retrieveEntities(content, acceptedCategoryNames); xlink.matchEntities(); ArrayList<Entity> entities = xlink.getEntities();

for (Entity entity : entities) {

System.out.println("Entity name: " + entity.getName());

System.out.println("Category: " + entity.getCategoryName());

System.out.println("Matching URIs: " + entity.getMatchingURIs());

System.out.println("-----");

}


xlink.storeMatchings(new File("folder_path"), "filename");


emc.shutdown(); // free memory


// add a new category to the component //

emc.startup();

emc.addNewCategory("shark", "url_of_sparql_endpoint", "uri_of_resource_class"); // throws CategoryAlreadyExistException, NotASparqlEndpointException, NotAURIException

acceptedCategoryNames.add("shark");

xlink.retrieveEntities(content, acceptedCategoryNames);

xlink.matchEntities();

ArrayList<Entity> entities = xlink.getEntities();

emc.shutdown(); // free memory

The 'Entity' Class

String getName ();

String getCategoryName ();

HashSet<String> getMatchingURIs ();

double getRank ();

HashMap<String, String> getProperties ();

void setName (String name);

void setCategoryName (String categoryName);

void setMatchingURIs(HashSet<String> matchingURIs);

void addMatchingURI (String uri);

void setRank (double rank);

void setProperties (HashMap<String, String> properties);

void addProperty (String propertyName, String propertyValue);

The 'Category' Class

void setName (String name);

void setEndpoint (Endpoint endpoint);

void setTemplateQuery (TemplateQuery template);

void setNamedEntities (Set<Entity> entities);

void setResourceClass (URI resourceClass);

void addNamedEntity (Entity entity);

String getName ();

Endpoint getEndpoint ();

TemplateQuery getTemplateQuery ();

Set<Entity> getNamedEntities ();

URI getResourceClass ();

The 'EntityMiningComponent' Class

void startup ();

void shutdown ();

HashSet<Category> getAvailableCategories ();

void addNewCategory (Category category);

void addNewCategory (String categoryName, URL endpoint, URI resourceClass);

void removeCategory (String categoryName);

void printAvailableCategories ();


The 'XLink' Class

void setEntityMiningComponent ();

void retrieveEntities (String content, HashSet<String> acceptedCategoryNames);

void matchEntities ();

File storeMatchings (String filename);

void storeMatchings (File folder, String filename);

void retrieveIncomingProperties ();

void retrieveOutcomingProperties ();

void retrieveAllProperties ();

ArrayList<Entity> getEntities ();