Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.ResIterator


    }
    for (String key: removeRange) range.remove(key);
    for (String key: removeProps) {
      // we can delete the property if it's not being used elsewhere
      Resource r = ont.getResource(key);
      ResIterator i1 = ont.listSubjectsWithProperty(OWL.onProperty,r);
      ResIterator i2 = ont.listSubjectsWithProperty(RDFS.subPropertyOf,r);
      // r should not be used in an existing restriction or subPropertyOf relation
      // ignore case where r is a subPropertyOf itself
      Resource s = null;
      while (i2.hasNext() && (s==null || s.equals(r)))
        s = i2.nextResource();
      if (!i1.hasNext() && (s==null || s.equals(r)))
        r.removeProperties();
    }
  }
View Full Code Here


  }
 
  @Override
  public List<Resource> getIndex() {
    List<Resource> result = new ArrayList<Resource>();
    ResIterator subjects = model.listSubjects();
    while (subjects.hasNext() && result.size() < DataSource.MAX_INDEX_SIZE) {
      Resource r = subjects.next();
      if (r.isAnon()) continue;
      result.add(r);
    }
    NodeIterator objects = model.listObjects();
    while (objects.hasNext() && result.size() < DataSource.MAX_INDEX_SIZE) {
View Full Code Here

      out.printf("<th>_debug</th>");
    }
    //out.printf("<th>Name</th>%n");
    out.printf("</tr>%n");

    ResIterator iter = model.listSubjects();
    while (iter.hasNext()) {
      Resource elem = iter.nextResource();
      String elemUri = elem.getURI();
      if ( elemUri != null ) {
        String elemUriSlash = elemUri.replace('#' , '/');
       
        // generate anchor for the term using "id" in the row:
View Full Code Here

        return x ;
    }
   
    private static List<Resource> getByType(Resource type, Model m)
    {
        ResIterator rIter = m.listSubjectsWithProperty(RDF.type, type) ;
        return Iter.toList(rIter) ;
    }
View Full Code Here

        IndexWriterConfig cfg = new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(), analyzer);
        IndexWriter writer = new IndexWriter(indexDir, cfg);
        writer.getConfig().setRAMBufferSizeMB(48);

        /* iterate SKOS concepts, create Lucene docs and add them to the index */
        ResIterator concept_iter = skosModel.listResourcesWithProperty(RDF.type,
                SKOS.Concept);
        while (concept_iter.hasNext()) {
            Resource skos_concept = concept_iter.next();

            Document concept_doc = createDocumentsFromConcept(skos_concept);

            writer.addDocument(concept_doc);
        }
View Full Code Here

//            }
        return output;
        }
   
    public String getReport( Model stats ) {
        ResIterator it = stats.listSubjectsWithProperty( RDF.type, EYE.statistic );
        double numStats = stats.listSubjectsWithProperty( RDF.type, EYE.statistic ).toList().size();
        double totalModelTriples = 0;
        List<String> onts = new ArrayList<String>(),
             ontCount = new ArrayList<String>(),
             ontPrefixes = new ArrayList<String>(),
             ontPrefixCount = new ArrayList<String>(),
             ontPrefixMapping = new ArrayList<String>();
        while ( it.hasNext() ) {
            Resource curr = it.nextResource();
            totalModelTriples += Double.parseDouble( curr.getProperty( EYE.modelSize ).getLiteral().getLexicalForm() );
            NodeIterator it2 = stats.listObjectsOfProperty( curr, EYE.usedOntology );
            while ( it2.hasNext() ) {
                Resource bn = stats.createResource( it2.nextNode().asNode().getBlankNodeId() );
                String ont = bn.getProperty( EYE.ontURI ).getObject().asNode().getURI();
View Full Code Here

        {
        Model wordModel = ModelFactory.createDefaultModel();
        for ( int a = 0; a < namespaces.length; a++ )
          wordModel.read("file:" + nsBase + "/" + namespaces[a]);
 
        ResIterator wordIt = wordModel.listSubjectsWithProperty( RDF.type );
        String fullwords = "";
        String loosewords = "";
        int size = wordModel.listSubjectsWithProperty( RDF.type ).toList().size();
        looseMappingArr = new String[size];
        fullMappingArr = new String[size];
        int i = 0;
       
        while ( wordIt.hasNext() )
          {
          Resource currWord = wordIt.nextResource();
          if ( currWord.isURIResource() )
            {
            fullwords += currWord.getURI() + '\n';
            loosewords += currWord.getLocalName() + '\n';
            looseMappingArr[i] = currWord.getLocalName();
View Full Code Here

    this.input = m;
    this.repair = report;
    this.output = this.input;
    boolean didRepair = false;
   
    ResIterator it = repair.listSubjectsWithProperty( EYE.repairType, EYE.setDatatype );
    while ( it.hasNext() )
      {
      Resource curr = it.nextResource();
        String literal = repair.listObjectsOfProperty( curr, EYE.onLiteral ).nextNode().asNode().getLiteralLexicalForm();

        Resource b = output.createResource( repair.listObjectsOfProperty( curr, EYE.onStatement ).nextNode().asNode().getBlankNodeId() );
        Resource subject = output.createResource( repair.listObjectsOfProperty( b, RDF.subject ).nextNode().asNode().getURI() );
        Property predicate = output.createProperty( repair.listObjectsOfProperty( b, RDF.predicate ).nextNode().asNode().getURI() );
        String oldType = repair.listObjectsOfProperty( curr, EYE.badDatatypeURI ).nextNode().asNode().getLiteralLexicalForm();
        String datatype = repair.listObjectsOfProperty( curr, EYE.newValue ).nextNode().asNode().getLiteralLexicalForm();
       
        output.remove( subject, predicate, output.createTypedLiteral( literal, oldType ) );
        output.add( subject, predicate, output.createTypedLiteral( literal, datatype ) );
        didRepair = true;
      }
   
    it = repair.listSubjectsWithProperty( EYE.repairType, EYE.setLanguage );
    while ( it.hasNext() )
      {
      Resource curr = it.nextResource();
        String literal = repair.listObjectsOfProperty( curr, EYE.onLiteral ).nextNode().asNode().getLiteralLexicalForm();

        Resource b = output.createResource( repair.listObjectsOfProperty( curr, EYE.onStatement ).nextNode().asNode().getBlankNodeId() );
        Resource subject = output.createResource( repair.listObjectsOfProperty( b, RDF.subject ).nextNode().asNode().getURI() );
        Property predicate = output.createProperty( repair.listObjectsOfProperty( b, RDF.predicate ).nextNode().asNode().getURI() );
View Full Code Here

  public void analyse( Report r, Model m, Model config )
    {
    this.input = m;
    this.repair = r.model();
   
    ResIterator it1 = repair.listSubjectsWithProperty( EYE.cardinalityFailure );
    while( it1.hasNext() )
      {
      Resource curr = it1.nextResource();
      RDFNode type = repair.listObjectsOfProperty( curr, EYE.onType ).nextNode();
      RDFNode prop = repair.listObjectsOfProperty( curr, EYE.onProperty ).nextNode();
      RDFNode b = repair.listObjectsOfProperty( curr, EYE.cardinality ).nextNode();
      RDFNode maxCardR = null;
      RDFNode minCardR = null;
View Full Code Here

  public void analyse( Report r, Model m, Model config )
    {
    this.input = m;
    this.repair = r.model();
   
    ResIterator it1 = repair.listSubjectsWithProperty( EYE.badDatatypeURI );
    while( it1.hasNext() )
      {
      Resource curr = it1.nextResource();
        String datatype = findDatatype( repair.listObjectsOfProperty( curr, EYE.onLiteral ).nextNode().asNode().getLiteralLexicalForm() );
        if ( datatype == null )
          { // Find the default action defined in config
          RDFNode defaultFix = config.listObjectsOfProperty( EYE.repairConfig, EYE.defaultLiteralFix ).nextNode();
          if ( defaultFix.equals( EYE.defaultLanguage ) )
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.ResIterator

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.