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

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


    assertEquals("\"1\"^^<" + XSDDatatype.XSDint.getURI() + ">",
        PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint)));
    assertEquals("\"1\"^^xsd:int",
        PrettyPrinter.toString(Node.createLiteral("1", null, XSDDatatype.XSDint), PrefixMapping.Standard));
    assertEquals("_:foo",
        PrettyPrinter.toString(Node.createAnon(new AnonId("foo"))));
    assertEquals("<http://example.org/>",
        PrettyPrinter.toString(Node.createURI("http://example.org/")));
    assertEquals("<" + RDF.type.getURI() + ">",
        PrettyPrinter.toString(RDF.type.asNode(), new PrefixMappingImpl()));
    assertEquals("rdf:type",
View Full Code Here


    assertEquals("Fixed(\"foo\"@en)",
        new FixedNodeMaker(Node.createLiteral("foo", "en", null), true).toString());
    assertEquals("Fixed(\"1\"^^<" + XSDDatatype.XSDint.getURI() + ">)",
        new FixedNodeMaker(Node.createLiteral("1", null, XSDDatatype.XSDint), true).toString());
    assertEquals("Fixed(_:foo)",
        new FixedNodeMaker(Node.createAnon(new AnonId("foo")), true).toString());
    assertEquals("Fixed(<http://example.org/>)",
        new FixedNodeMaker(Node.createURI("http://example.org/"), true).toString());
  }
View Full Code Here

    }
  };
 
  private Resource getResource(String id) {
    if (id.startsWith("_:"))
      return rdf.createResource(new AnonId(id.substring(2))); // blank
    else
      return rdf.createResource(id); // named
  }
View Full Code Here

    private static Node makeNode(String lex, String datatype, String lang, ValueType vType)
    {
        switch (vType)
        {
            case BNODE:
                return Node.createAnon(new AnonId(lex)) ;
            case URI:
                return Node.createURI(lex) ;
            case STRING:
                return Node.createLiteral(lex, lang, false) ;
            case XSDSTRING:
View Full Code Here

    {
        if ( s.startsWith("Double"))
            System.err.println(s) ;
       
        if ( s.startsWith("_:") )
            return Node.createAnon(new AnonId(s.substring(2))) ;
        return stringToNode(s, prefixMapping) ;
    }
View Full Code Here

    {
        // Is it a bNode label? i.e. <_:xyz>
        if ( isBNodeIRI(iri) )
        {
            String s = iri.substring(bNodeLabelStart.length()) ;
            Node n = Node.createAnon(new AnonId(s)) ;
            return n ;
        }
        return Node.createURI(iri) ;
    }
View Full Code Here

    /**
         Check that anonIDs are distinct whichever state the flag is in.
    */
    public void doTestAnonID() {
        AnonId id1 = AnonId.create();
        AnonId id2 = AnonId.create();
        AnonId id3 = AnonId.create();
        AnonId id4 = AnonId.create();
       
        assertDiffer( id1, id2 );
        assertDiffer( id1, id3 );
        assertDiffer( id1, id4 );
        assertDiffer( id2, id3 );
View Full Code Here

        Test that creation of an AnonId from an AnonId string preserves that
        string and is equal to the original AnonId.
    */
    public void testAnonIdPreserved()
        {
        AnonId anon = AnonId.create();
        String id = anon.toString();
        assertEquals( anon, AnonId.create( id ) );
        assertEquals( id, AnonId.create( id ).toString() );
        }
View Full Code Here

    public Node asNode()
    {
        switch(tokenType)
        {
            // Assumes that bnode labels have been sorted out already.
            case BNODE : return Node.createAnon(new AnonId(tokenImage)) ;
            case IRI :   return Node.createURI(tokenImage) ;
            case PREFIXED_NAME :
                return Node.createURI("urn:prefixed-name:"+tokenImage+":"+tokenImage2) ;
            case DECIMAL :  return Node.createLiteral(tokenImage, null, XSDDatatype.XSDdecimal;
            case DOUBLE :   return Node.createLiteral(tokenImage, null, XSDDatatype.XSDdouble;
View Full Code Here

//                return Node_RuleVariable.WILD;
            } else if (token.startsWith("<") && token.endsWith(">")) {
                String uri = token.substring(1, token.length()-1);
                return Node.createURI(uri);
            } else if (token.startsWith( "_" )) { // TODO rationalise [this is for the RIF code]
                return Node.createAnon( new AnonId( token.substring( 1 ) ) );
            } else if (token.indexOf(':') != -1) {
                String exp = prefixMapping.expandPrefix(token); // Local map first
                exp = PrintUtil.expandQname(exp)// Retain global map for backward compatibility
                if (exp == token) {
                    // No expansion was possible
View Full Code Here

TOP

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

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.