Java Code Examples for com.hp.hpl.jena.util.iterator.ExtendedIterator#hasNext()

The following examples show how to use com.hp.hpl.jena.util.iterator.ExtendedIterator#hasNext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessingUtils.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
public static List<String> getAllClasses ()
{
   List<String>classes = new ArrayList<String>();
   DrbCortexModel model;
   try
   {
      model = DrbCortexModel.getDefaultModel();
   }
   catch (IOException e)
   {
      return classes;
   }
   ExtendedIterator it= model.getCortexModel().getOntModel().listClasses();
   while (it.hasNext())
   {
      OntClass cl = (OntClass)it.next();
      String uri = cl.getURI();
      if (uri!=null)
         classes.add(uri);
   }
   return classes;
}
 
Example 2
Source File: ConceptImpl.java    From semanticMDR with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setParentConcept(ObjectClass parent) {
	if (parent != null) {
		this.addProperty(RDFS.subClassOf, parent.asMDRResource());
	} else {
		ExtendedIterator<OntClass> l = this.listSuperClasses();
		OntClass found = null;
		while (l.hasNext()) {
			OntClass ontClass = l.next();
			if (ontClass.hasSuperClass(mdrDatabase.getVocabulary().Concept)) {
				found = ontClass;
			}
		}
		if (found != null) {
			this.removeProperty(RDFS.subClassOf, found);
		}
	}
}
 
Example 3
Source File: ProcessingUtils.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
public static List<String>getSuperClass(String URI)
{
   List<String>super_classes = new ArrayList<String>();
   DrbCortexItemClass cl = DrbCortexItemClass.getCortexItemClassByName(URI);
   ExtendedIterator it = cl.getOntClass().listSuperClasses(true);
   while (it.hasNext())
   {
      String ns = ((OntClass)it.next()).getURI();
      if(ns!=null) super_classes.add(ns);
   }
   return super_classes;
}
 
Example 4
Source File: ProcessingUtils.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
public static List<String>getSubClass(String URI)
{
   List<String>sub_classes = new ArrayList<String>();
   DrbCortexItemClass cl = DrbCortexItemClass.getCortexItemClassByName(URI);
   ExtendedIterator it = cl.getOntClass().listSubClasses(true);
   while (it.hasNext())
   {
      String ns = ((OntClass)it.next()).getURI();
      if(ns!=null) sub_classes.add(ns);
   }
   return sub_classes;
}
 
Example 5
Source File: ScannerFactory.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Retrieve the dhus system supported items for file scanning processing.
 * Is considered supported all classes having
 * <code>http://www.gael.fr/dhus#metadataExtractor</code> property
 * connection.
 * @return the list of supported class names.
 */
public static synchronized String[] getDefaultCortexSupport ()
{
   DrbCortexModel model;
   try
   {
      model = DrbCortexModel.getDefaultModel ();
   }
   catch (IOException e)
   {
      throw new UnsupportedOperationException (
         "Drb cortex not properly initialized.");
   }

   ExtendedIterator it=model.getCortexModel ().getOntModel ().listClasses ();
   List<String>list = new ArrayList<String> ();

   while (it.hasNext ())
   {
      OntClass cl = (OntClass)it.next ();

      OntProperty metadata_extractor_p = cl.getOntModel().getOntProperty(
            "http://www.gael.fr/dhus#support");

      StmtIterator properties = cl.listProperties (metadata_extractor_p);
      while (properties.hasNext ())
      {
         Statement stmt = properties.nextStatement ();
         LOGGER.debug ("Scanner Support Added for " +
            stmt.getSubject ().toString ());
         list.add (stmt.getSubject ().toString ());
      }
   }
   return list.toArray (new String[list.size ()]);
}
 
Example 6
Source File: ConceptImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ObjectClass> getSubConcepts() {
	ExtendedIterator<OntClass> l = this.listSubClasses();
	List<ObjectClass> ocList = new ArrayList<ObjectClass>();

	while (l.hasNext()) {
		OntClass res = l.next();
		ocList.add(new ConceptImpl(res, mdrDatabase));
	}

	return ocList;
}
 
Example 7
Source File: R2RMLReader.java    From GeoTriples with Apache License 2.0 2 votes vote down vote up
private TermMap createTransformationValuedTermMap(Resource r) {
	TransformationValuedTermMap result = new TransformationValuedTermMap();
	result.setFunction(ConstantIRI.create(getString(r, RRX.function)));
	
	
	List<TermMap> arguments=new ArrayList<TermMap>();
	//Resource list = getResource(r, RRX.argumentMap);
	
	RDFNode list2 = r.getProperty(RRX.argumentMap).getObject();;
	
	
	
	RDFList rdfList = list2.as( RDFList.class );
       ExtendedIterator<RDFNode> items = rdfList.iterator();
       while ( items.hasNext() ) {
           Resource item = items.next().asResource();            
           if(item.getProperty(RR.constant)!=null)
           {
   			arguments.add(createConstantValuedTermMap(item));
   		}
           if(item.getProperty(RR.column)!=null) {
			arguments.add(createColumnValuedTermMap(item));
		}
		if(item.getProperty(RRX.function)!=null) {
			arguments.add(createTransformationValuedTermMap(item));
		}
		if(item.getProperty(RR.template)!=null) {
			arguments.add(createTemplateValuedTermMap(item));
		}
           
       }
	
	
	
	
	
	
	
	
       
	result.setTermMaps(arguments);
	readColumnOrTemplateValuedTermMap(result, r);
	return result;
}