Пример #1
0
  /**
   * This function takes a class uri and returns the object properties who have this class in their
   * domain. If second parameter set to True, it also returns the object properties inherited from
   * parents of the given class.
   *
   * @param domainUri
   * @param inheritance
   * @return
   */
  public HashSet<String> getObjectPropertiesOfClass(String domainUri, boolean inheritance) {

    HashSet<String> direct = ontCache.getDirectOutObjectProperties().get(domainUri);
    if (!inheritance) return direct;

    HashSet<String> all = new HashSet<String>();
    HashSet<String> indirect = ontCache.getIndirectOutObjectProperties().get(domainUri);
    if (direct != null) all.addAll(direct);
    if (indirect != null) all.addAll(indirect);
    return all;
  }
Пример #2
0
  public Map<String, Label> getObjectPropertiesByDomain(String domainUri, boolean recursive) {

    HashSet<String> objectProperties = ontCache.getDirectOutObjectProperties().get(domainUri);
    if (recursive) {
      HashSet<String> propRecursive = ontCache.getIndirectOutObjectProperties().get(domainUri);
      if (propRecursive != null) objectProperties.addAll(propRecursive);
    }
    HashMap<String, Label> results = new HashMap<String, Label>();

    if (objectProperties == null) return results;

    for (String op : objectProperties) {
      results.put(op, ontCache.getPropertyLabel(op));
    }

    return results;
  }