Exemplo n.º 1
0
 private static String getIndividualNameList(String className) {
   Set<OWLIndividual> continents = handler.getIndividuals(className);
   Iterator<OWLIndividual> it = continents.iterator();
   ArrayList<String> continentList = new ArrayList<String>();
   while (it.hasNext()) {
     OWLIndividual continent = it.next();
     Set<OWLLiteral> continentNames = handler.getDataRelationIndividuals(continent, "name");
     if (continentNames == null) continue;
     continentList.add(continentNames.iterator().next().getLiteral());
   }
   return listToCommaSeperate(continentList);
 }
Exemplo n.º 2
0
 public String getContinent() {
   HashMap<String, Integer> map = new HashMap<String, Integer>();
   for (String currentCountry : countries) {
     OWLIndividual individual = handler.getIndividual(currentCountry);
     Set<OWLIndividual> individuals = handler.getObjectRelationIndividuals(individual, "liesIn");
     if (individuals == null) return null;
     Iterator<OWLIndividual> it = individuals.iterator();
     if (individuals.iterator().hasNext()) {
       OWLIndividual continent = it.next();
       Set<OWLLiteral> continents = handler.getDataRelationIndividuals(continent, "name");
       Iterator<OWLLiteral> it2 = continents.iterator();
       if (it2.hasNext()) {
         OWLLiteral continentLiteral = it2.next();
         String continentName = continentLiteral.getLiteral();
         addToList(continentName, map);
       }
     }
   }
   return getMostPopular(map);
 }
Exemplo n.º 3
0
  public void writeToFile(OwlHandler owl) {

    owl.addIndividual("Perpetrator", name);
    owl.addDataProperty("name", name, name);

    // adding classificationrelation
    for (String classification : classifications) {
      if (!owl.addObjectRelation(name, "hasClassification", classification)) {
        owl.addIndividual("Classification", classification);
        owl.addDataProperty("name", classification, classification);
        owl.addObjectRelation(name, "hasClassification", classification);
      }
    }

    // adding bases
    for (String base : bases) {
      if (!owl.addObjectRelation(name, "hasBaseOfOperation", base)) {
        owl.addIndividual("Country", base);
        owl.addDataProperty("name", base, base);
        owl.addObjectRelation(name, "hasBaseOfOperation", base);
      }
    }

    // adding name property
    owl.addDataProperty("name", name, name);
  }