Package org.ontoware.rdf2go.model.node

Examples of org.ontoware.rdf2go.model.node.URI


    init();
   
    // creating resources
    String foafURI = "http://xmlns.com/foaf/0.1/";
    URI max = model.createURI("http://xam.de/foaf.rdf.xml#i");
    URI name = model.createURI(foafURI+"#term_name");
    URI icqId = model.createURI(foafURI+"#term_icqChatID");
    URI typeInteger = XSD._integer;
    BlankNode konrad = model.createBlankNode();
    PlainLiteral maxNameAsPlainLiteral = model.createPlainLiteral("Max Völkel");
    DatatypeLiteral number = model.createDatatypeLiteral("123", typeInteger);
    LanguageTagLiteral konradNameEnglish = model.createLanguageTagLiteral("Konrad Voelkel", "en");
    LanguageTagLiteral konradNameGerman = model.createLanguageTagLiteral("Konrad Völkel", "de");
View Full Code Here


    /*
     * before we can do anything useful, we have to define the uris we want
     * to use
     */
    // use the uris defined by foaf
    URI foafName = model.createURI("http://xmlns.com/foaf/0.1/name");
    URI foafPerson = model.createURI("http://xmlns.com/foaf/0.1/Person");
    URI foafTitle = model.createURI("http://xmlns.com/foaf/0.1/title");
    URI foafKnows = model.createURI("http://xmlns.com/foaf/0.1/knows");
    URI foafHomepage = model.createURI("http://xmlns.com/foaf/0.1/homepage");
    // use a blank node for the person
    BlankNode werner = model.createBlankNode();
   
    /*
     * now we can add statements to the model (for easier reading we
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public static void main(String[] args) throws ModelRuntimeException {
    Model m = new ModelImplJena26(Reasoning.rdfs);
    URI u = RDF.Bag;
    URI p = RDF.type;
    @SuppressWarnings("unused")
    HashSet<String> names = (HashSet<String>)getAllValues(m, u, p, String.class);
  }
View Full Code Here

    Map<String, URI> nsMap = new HashMap<String, URI>();
    nsMap.put("rdf", new URIImpl(
        "http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
    String LOCAL = "http://example.com#";
    nsMap.put("", new URIImpl(LOCAL));
    URI a = new URIImpl(LOCAL + "a");
    URI b = new URIImpl(LOCAL + "b");
    URI c = new URIImpl(LOCAL + "c");

    m.addStatement(a, b, c);
    m.addStatement(a, RDF.type, c);
    log.debug("Before");
    m.dump();

    String constructRemove = "?x a " + c.toSPARQL();
    String constructAdd = "?x a " + b.toSPARQL();
    String where = constructRemove;

    SearchRemoveAddRule.searchAndReplace(m, nsMap, where, constructRemove,
        constructAdd);
View Full Code Here

  @Test
  public void testUriRename() {
    Model m = RDF2Go.getModelFactory().createModel();
    m.open();

    URI a = new URIImpl("urn:test:a");
    URI b = new URIImpl("urn:test:b");
    URI c = new URIImpl("urn:test:c");

    URI superRel = new URIImpl(
        "http://www.semanticdesktop.org/ontologies/2007/09/cds/hasSuperRelation");
    m.addStatement(superRel, b, c);
    m.addStatement(a, superRel, c);
    m.addStatement(a, b, superRel);
    Map<String, URI> nsMap = new HashMap<String, URI>();
View Full Code Here

  @Test
  public void testUriPrefixRename() {
    Model m = RDF2Go.getModelFactory().createModel();
    m.open();

    URI a = new URIImpl("urn:test:a");
    URI b = new URIImpl("urn:test:b");
    URI c = new URIImpl("urn:test:c");

    URI superRel = new URIImpl(
        "http://www.semanticdesktop.org/ontologies/2007/09/cds/hasSuperRelation");
    m.addStatement(superRel, b, c);
    m.addStatement(a, superRel, c);
    m.addStatement(a, b, superRel);
    NamespaceSearchReplaceRule.searchAndReplace(m, "urn:test:", "http://example.com#");
View Full Code Here

 
  @Test
  public void testDataTypeEqualness() throws Exception {
   
    // die erste DatenTyp URI
    URI testA = new URIImpl("test://somedata-A", false);
    // die zweite DatenTyp URI
    URI testB = new URIImpl("test://somedata-B", false);
   
    // der erste BaseDatatype wird von der ersten DatenTyp URI erzeugt
    BaseDatatype BDtestA1 = new BaseDatatype(testA + "");
    // der zweite BaseDatatype ebenso
    BaseDatatype BDtestA2 = new BaseDatatype(testA + "");
View Full Code Here

    // wieder nicht.
   
    // L�sung siehe Funktion testDataTypesWithUnknownType()
   
    // die erste DatenTyp URI
    URI testA = new URIImpl("test://somedata-A", false);
    // die zweite DatenTyp URI
    URI testB = new URIImpl("test://somedata-B", false);
   
    // der erste BaseDatatype wird von der ersten DatenTyp URI erzeugt
    GeneralDataType BDtestA1 = new GeneralDataType(testA + "");
    // der zweite BaseDatatype ebenso
    GeneralDataType BDtestA2 = new GeneralDataType(testA + "");
View Full Code Here

        Statement answer = queryC.next();
        Resource rx = answer.getSubject();
        // we do not create constants for blank nodes
        if(!(rx instanceof URI))
          continue;
        URI vx = (URI)rx;
        String uri = vx.toString();
        // check URI once and for all
        boolean valid = this.model.isValidURI(uri);
        if(!valid) {
          this.outP.println("    /* cannot export " + uri + ", not a valid URI */");
        } else {
View Full Code Here

   
    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);
        s = new URIImpl(sURI);
      }
      if(p.toString().startsWith(searchURIPrefix)) {
        match = true;
        String pURI = p.toString().replace(searchURIPrefix, replaceURIPrefix);
        p = new URIImpl(pURI);
       
      }
      if(o instanceof URI && o.asURI().toString().startsWith(searchURIPrefix)) {
        match = true;
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.URI

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.