Package org.ontoware.rdf2go.model

Examples of org.ontoware.rdf2go.model.Statement


    ClosableIterator<? extends Statement> sit = model.findStatements(
        subject, predicate, object);
    assertNotNull(sit);
    assertTrue(sit.hasNext());

    Statement s2 = sit.next();
    URI s2s = (URI) s2.getSubject();
    URI s2p = s2.getPredicate();
    URI s2o = (URI) s2.getObject();

    assertEquals(subject, s2s);
    assertEquals(predicate, s2p);
    assertEquals(object, s2o);
View Full Code Here


    try {

      ClosableIterator<? extends Statement> it = this.model.findStatements(this.id,
          Variable.ANY, Variable.ANY);
      while (it.hasNext()) {
        Statement stmt = it.next();
        Map.Entry<URI, Object> e = new EntryImpl<URI, Object>(this,
            stmt.getPredicate(), stmt.getObject());
        entries.add(e);
      }
      it.close();
      return entries;
    } catch (Exception e) {
View Full Code Here

                        // figure out cardinality
                       
                        ClosableIterator<Statement> it = m.findStatements(Variable.ANY,
                                OWL.onProperty, rp.getResource());
                        while(it.hasNext()) {
                            Statement stmt = it.next();
                            org.ontoware.rdf2go.model.node.Resource restrictionResource = stmt
                                    .getSubject();
                            OWL_Protege_NRL_Restriction restriction = OWL_Protege_NRL_Restriction
                                    .getInstance(m, restrictionResource);
                           
                            int min = restriction.getAllMinCardinality_asList().get(0);
View Full Code Here

   
    // adding a statement with a DatatypeLiteral
    model.addStatement(konrad, icqId, number);
   
    // adding a Statement object
    Statement maxNameStatement = model.createStatement(max, name, maxNameAsPlainLiteral);
    model.addStatement(maxNameStatement);
   
    // adding a set of Statement objects
    Statement konradNameEnglishStatement = model.createStatement(konrad, name, konradNameEnglish);
    Statement konradNameGermanStatement = model.createStatement(konrad, name, konradNameGerman);
    ArrayList<Statement> konradNameStatements = new ArrayList<Statement>();
    konradNameStatements.add(konradNameGermanStatement);
    konradNameStatements.add(konradNameEnglishStatement);
    model.addAll(konradNameStatements.iterator());
   
View Full Code Here

 
  @Override
  public boolean equals(Object other) {
   
    if(other instanceof Statement) {
      Statement stmt = (Statement)other;
      boolean e = super.equals(stmt);
      log.debug("statements are equal? " + e + " now the context");
      if(e && stmt.getContext() != null && this.getContext() != null)
        return stmt.getContext().equals(this.getContext());
      else
        return e;
    }
    return false;
  }
View Full Code Here

    Model remove = RDF2Go.getModelFactory().createModel();
    remove.open();
   
    ClosableIterator<Statement> it = model.iterator();
    while(it.hasNext()) {
      Statement stmt = it.next();
      Resource s = stmt.getSubject();
      URI p = stmt.getPredicate();
      Node o = stmt.getObject();
     
      boolean match = false;
      if(s instanceof URI && s.asURI().toString().startsWith(searchURIPrefix)) {
        match = true;
        String sURI = s.asURI().toString().replace(searchURIPrefix, replaceURIPrefix);
View Full Code Here

      this.connection.begin();
      try {
        try {
          // add
          while(iterator.hasNext()) {
            Statement s = iterator.next();
            org.openrdf.model.URI context = ConversionUtil.toOpenRDF(s.getContext(),
                    this.valueFactory);
            org.openrdf.model.Statement sd = ConversionUtil.toOpenRDF(s,
                    this.valueFactory);
            this.connection.add(sd, context);
          }
View Full Code Here

      this.connection.begin();
      try {
        try {
          // add
          while(iterator.hasNext()) {
            Statement s = iterator.next();
            org.openrdf.model.URI context = ConversionUtil.toOpenRDF(s.getContext(),
                    this.valueFactory);
            org.openrdf.model.Statement sd = ConversionUtil.toOpenRDF(s,
                    this.valueFactory);
            this.connection.remove(sd, context);
          }
View Full Code Here

   */
  public static Statement findStatement(Model model, ResourceOrVariable subject,
          UriOrVariable predicate, NodeOrVariable object) {
    ClosableIterator<? extends Statement> i = model.findStatements(subject, predicate, object);
    if(i.hasNext()) {
      Statement s = i.next();
      i.close();
      return s;
    }
    // else
    return null;
View Full Code Here

  public static Model selectLanguage(Model model, String language) {
    Model result = RDF2Go.getModelFactory().createModel();
    result.open();
    ClosableIterator<Statement> it = model.iterator();
    while(it.hasNext()) {
      Statement s = it.next();
      if(s.getObject() instanceof LanguageTagLiteral) {
        LanguageTagLiteral lit = s.getObject().asLanguageTagLiteral();
        if(lit.getLanguageTag().startsWith(language)) {
          result.addStatement(s);
        }
        // else don't copy
      } else {
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.Statement

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.