Examples of OntResource


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


  private void nullify(OntModel ont, Restrictions rest, Context ctx, String uri, element def, OntProperty p) {
    p.addProperty(RDF.type,OWL.ObjectProperty);
    if (rest!=null || ctx.isGlobalElement(def)) {
      OntResource r = p.getRange();
      p.removeRange(r);
      Vector<Resource> v = new Vector<Resource>();
      v.add(RDF.nil);
      RDFList nil = ont.createList(v.iterator());
      OntClass c = ont.createEnumeratedClass(null,nil);
View Full Code Here

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

   
    PropertyInfo entityInfo = new PropertyInfo();
    entityInfo.setUri(entityUri);
    entityInfo.setLocalName(localName);

    OntResource domain = null;
    if ( prop instanceof OntProperty ) {
      OntProperty ontProp = (OntProperty) prop;
      domain = ontProp.getDomain();
    }
    if ( domain != null &&  domain.isURIResource() ) {
      String domainUri = domain.getURI();
      entityInfo.setDomainUri(domainUri);
    }

    _addProps(entityUri, entityInfo, ontModel, null);
    return entityInfo;
View Full Code Here

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

    }

    public Set<OntResource> collect( Iterator i ) {
        Set<OntResource> set = new HashSet<OntResource>();
        while( i.hasNext() ) {
            OntResource res = (OntResource) i.next();
            if( res.isAnon() )
                continue;
           
            set.add( res );
        }
       
View Full Code Here

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

    return concepts.toArray(new ConceptTO[concepts.size()]);
  }

  public Concept getConcept(String conceptUri, String contextUri)
      throws ConceptNotFoundException {
    OntResource resource = getOntModel().getOntResource(conceptUri);
    if(resource == null){
      throw new ConceptNotFoundException("Concept "+conceptUri+" can not be built.");
    }
    return conceptFactory.createConceptResource(resource);
  }
View Full Code Here

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

    return conceptFactory.createConceptResource(resource);
  }

  public ConceptTO getConceptTO(String conceptUri)
      throws ConceptNotFoundException {
    OntResource resource = getOntModel().getOntResource(conceptUri);
    if(resource == null){
      throw new ConceptNotFoundException("Concept "+conceptUri+" can not be built.");
    }
    return OntologyHelper.createConceptTO(resource);
  }
View Full Code Here

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

  }
     
    private List<ConceptTO> createConceptsFromResources(ExtendedIterator it) {
      List<ConceptTO> concepts = new LinkedList<ConceptTO>();
        for(;it.hasNext();){
           OntResource resource = (OntResource) it.next();          
           try{
             //Check if the resource in anonymous created by Jena
             if(resource.getURI() != null){                           
               concepts.add(OntologyHelper.createConceptTO(resource));
             }
              }catch(ConceptUnsupportedOperation e){
               logger.debug("Discarding create concept from non user class "+resource.getURI());
           }
        }
    return concepts;
    }
View Full Code Here

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

    }      
    return relations.toArray(new RelationTO[relations.size()]);
  }

  public RelationTO getRelationTO(String relationUri) throws ConceptNotFoundException {
    OntResource resource = getOntModel().getOntResource(relationUri);
    if(resource == null){
      throw new ConceptNotFoundException("Concept "+relationUri+" can not be built.");
    }
    return new RelationTO(OntologyHelper.createConceptTO(resource));
  }
View Full Code Here

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

   
    private List createRelationsForInstance(String uri, TypeHierarchy hierarchy, String description, String value, Iterator it, HashMap relationsMap){
        List relations = new LinkedList();
        for(;it.hasNext();){  
            Object o = it.next();          
            OntResource withInstance =  (OntResource) o;
            Relation relation;
            if(relationsMap.containsKey(uri)){
                relation = (Relation) relationsMap.get(uri);
             }else{
                 relation = createRelationFromInstance(uri, hierarchy, description, value);
View Full Code Here

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

        logger.info("OntProperties "+ontModel.listOntProperties().toList().size());
//        showIterator(ontModel.listOntProperties(),logger,"\t\t OntProperty ");              
    }
   
    public static void showIterator(Iterator iterator,Logger logger,String ident){
        OntResource ontResource;
        for(;iterator.hasNext();){           
            ontResource = (OntResource) iterator.next();           
            logger.info(ident+"Resource "+ontResource.getURI()+"  "+ontResource.getNameSpace());
        }
    }
View Full Code Here

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

    Map subclasses = new HashMap();
 
    Iterator iter = classMap.keySet().iterator();
    while (iter.hasNext()) {
      //OntClass resource = (OntClass) iter.next();
      OntResource resource = (OntResource) iter.next();
 
      if (resource instanceof OntClass) {
        //get subclasses
        for (Iterator i=((OntClass)resource).listSubClasses(); i.hasNext();) {
          OntResource subclass = (OntResource) i.next();
          for (Iterator j=subclass.listLabels(null); j.hasNext();) {
            Literal l = (Literal) j.next();
            subclasses.put(l.toString(), "1");
          }
        }
        //get individuals
        for (Iterator i=((OntClass)resource).listInstances(); i.hasNext();) {
          OntResource subclass = (OntResource) i.next();
          for (Iterator j=subclass.listLabels(null); j.hasNext();) {
            Literal l = (Literal) j.next();
            subclasses.put(l.toString(), "1");
          }
        }
      } else if (resource instanceof Individual) {
        for (Iterator i=resource.listSameAs(); i.hasNext();) { 
          OntResource subclass = (OntResource) i.next();
          for (Iterator j=subclass.listLabels(null); j.hasNext();) {
            Literal l = (Literal) j.next();
            subclasses.put(l.toString(), "1");
          }   
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.