Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.Individual


   
    return new InterfaceHandle(individual, this);
  }
 
  public ClassHandle getClassHandleFor(String uniqueName, String localName) {
    Individual individual = fetchIndividual(uniqueName, localName, IJavaModelEntities.JAVA_CLASS);
   
    return new ClassHandle(individual, this);
  }
View Full Code Here


   
    return typeHandle;
  }
 
  public FieldHandle getFieldHandleFor(String uniqueName, String localName) {
    Individual individual = fetchIndividual(uniqueName, localName, IJavaModelEntities.JAVA_FIELD);
   
    return new FieldHandle(individual, this);
  }
View Full Code Here

   
    return new FieldHandle(individual, this);
  }
 
  public MethodHandle getMethodHandleFor(String uniqueName, String localName) {
    Individual individual = fetchIndividual(uniqueName, localName, IJavaModelEntities.JAVA_METHOD);
   
    return new MethodHandle(individual, this);
  }
View Full Code Here

   
    return new MethodHandle(individual, this);
  }
 
  public ConstructorHandle getConstructorHandleFor(String uniqueName, String localName) {
    Individual individual = fetchIndividual(uniqueName, localName, IJavaModelEntities.JAVA_CONSTRUCTOR);
   
    return new ConstructorHandle(individual, this);
  }
View Full Code Here

   
    return new ConstructorHandle(individual, this);
  }
 
  public MethodParameterHandle getMethodParameterHandleFor(String uniqueName, String localName, String typeName) {
    Individual individual = fetchIndividual(uniqueName, localName, typeName, IJavaModelEntities.JAVA_PARAMETER);
   
    return new MethodParameterHandle(individual, this);
  }
View Full Code Here

      if(transactionsSupported) { baseModel.commit(); }
    }
  }

  private Individual fetchIndividual(String uniqueName, String localName, String label, Resource ontClass) throws InvalidResourceException {
    Individual individual = getIndividual(uniqueName);
   
    if(individual == null) {
      individual = createIndividual(uniqueName, ontClass);
      individual.addLiteral(RDFS.label, label)
            .addLiteral(IJavaModelEntities.HAS_IDENTIFIER, localName);
    } else {
      checkOntClass(ontClass, individual);
    }
   
View Full Code Here

                                               double degradingCoefficient,
                                               String keyword,
                                               List<RelatedKeyword> relatedKeywords) {

        long t1 = System.currentTimeMillis();
        Individual ind = model.getIndividual(individualURI);
        if (ind != null && ind.isURIResource()) {
            for (OntClass ontClass : ind.listOntClasses(true).toSet()) {
                if (ontClass != null && ontClass.isURIResource()) {
                    computeClassClosure(ontClass.getURI(), 6, initialScore, 1.5, keyword, relatedKeywords);
                }
            }
        }
View Full Code Here

            List<? extends OntResource> instances = ontClass.listInstances(true).toList();
            for (OntResource instance : instances) {
                if (instance == null || instance.isAnon() || !instance.isIndividual()) {
                    continue;
                } else {
                    Individual individual = instance.asIndividual();
                    String rkw = individual.getLocalName();
                    relatedKeywords.add(new RelatedKeywordImpl(rkw, initialScore / degradingCoefficient,
                            "Ontology"));
                    log.debug("Added {} as a relate keyword to {} ", rkw, keyword);
                }
            }
View Full Code Here

     *            Unique reference for which the {@link Individual} is requested
     * @return {@link Individual} if there is a valid already created individual for <i>reference</i>,
     *         otherwise <code>null</code>.
     */
    public Individual getIndividualByReference(String reference) {
        Individual ind = null;
        try {
            ind = getLooseIndividualByReference(reference);
        } catch (UnsupportedPolymorphismException e) {
            log.warn("Another type of resource has been created for the reference: {}", reference);
            return null;
        } catch (ConversionException e) {
            log.warn("Another type of resource has been created for the reference: {}", reference);
            return null;
        }
        if (ind != null) {
            if (ind.isClass()) {
                log.debug("Resource {} is already a class", ind.getURI());
                return null;
            } else if (ind.isIndividual()) {
                return ind;
            }
        }
        return null;
    }
View Full Code Here

     * @return {@link Individual} instance if there is a real already created one or there is no resources
     *         created for the specified CMSObject. If there is an ontology class created for the CMSObject,
     *         it returns <code>null</code>.
     */
    public Individual createIndividualByCMSObject(CMSObject cmsObject, Resource klass) {
        Individual ind = null;
        try {
            ind = getLooseIndividualByReference(cmsObject.getUniqueRef());
        } catch (UnsupportedPolymorphismException e) {
            log.warn("Another type of resource has been created for the CMS Object: {}",
                cmsObject.getLocalname());
            return null;
        } catch (ConversionException e) {
            log.warn("Another type of resource has been created for the CMS Object: {}",
                cmsObject.getLocalname());
            return null;
        }

        if (ind == null) {
            String indURI = namingStrategy.getIndividualName(ontologyURI, cmsObject);
            ind = ontModel.createIndividual(indURI, klass);
            ind.addProperty(CMSAdapterVocabulary.CMSAD_RESOURCE_REF_PROP, cmsObject.getUniqueRef());
            return ind;
        } else if (ind.isClass()) {
            log.debug("Resource {} is already a class", ind.getURI());
            return null;
        } else {
            return ind;
        }

View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.Individual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.