Пример #1
0
def Xtest_versa_syntax1():
    #logging.debug(recs)
    m = connection()
    m.create_space()
    #from_markdown(VERSA_LITERATE1, m, encoding='utf-8')
    from_markdown(VERSA_LITERATE1, m)
    logging.debug('VERSA LITERATE EXAMPLE 1')
    for stmt in m.match():
        logging.debug('Result: {0}'.format(repr(stmt)))
Пример #2
0
def Xtest_versa_syntax1():
    #logging.debug(recs)
    m = connection()
    m.create_space()
    #from_markdown(VERSA_LITERATE1, m, encoding='utf-8')
    from_markdown(VERSA_LITERATE1, m)
    logging.debug('VERSA LITERATE EXAMPLE 1')
    for link in m.match():
        logging.debug('Result: {0}'.format(repr(link)))
Пример #3
0
def run(infile):
    m = memory.connection()
    from_markdown(infile.read(), m)
    #from versa.util import jsondump
    #jsondump(m, open('/tmp/foo.json', 'w'))
    for poem in resources_by_type(m, 'http://uche.ogbuji.net/poems/poem'):
        choice = '@choice' in list(map(operator.itemgetter(TARGET), m.match(poem, 'http://www.w3.org/2005/Atom/category')))
        if not choice: continue
        d = parse_date(simple_lookup(m, poem, 'http://www.w3.org/2005/Atom/updated'))
        source = next(m.match(poem, 'http://www.w3.org/2005/Atom/source'))
        source = source[ATTRIBUTES]['title']
        title = simple_lookup(m, poem, 'http://www.w3.org/2005/Atom/title')
        print('\t'.join(("'" + title + "'", 'Poem', d.strftime('%B, %Y'), source)))
        print()
Пример #4
0
def test_versa_syntax1():
    config = {
        'autotype-h1': 'http://example.org/r1',
        'autotype-h2': 'http://example.org/r2',
        'interpretations': {
            VERSA_BASEIRI + 'refines': VERSA_BASEIRI + 'resource',
            VERSA_BASEIRI + 'properties': VERSA_BASEIRI + 'resourceset',
            VERSA_BASEIRI + 'synonyms': VERSA_BASEIRI + 'resourceset'
        }
    }

    m = memory.connection(baseuri='http://example.org/')
    #from_markdown(VERSA_LITERATE1, m, encoding='utf-8')
    doc = open(os.path.join(RESOURCEPATH, 'ubibframe.md')).read()
    from_markdown(doc, m, config=config)
    logging.debug('VERSA LITERATE EXAMPLE 1')
    for stmt in m.match():
        logging.debug('Result: {0}'.format(repr(stmt)))
        #assert result == ()
    assert results == None, "Boo! "
Пример #5
0
def test_versa_syntax1():
    config = {
        'autotype-h1': 'http://example.org/r1',
        'autotype-h2': 'http://example.org/r2',
        'interpretations': {
            VERSA_BASEIRI + 'refines': VERSA_BASEIRI + 'resourceset',
            VERSA_BASEIRI + 'properties': VERSA_BASEIRI + 'resourceset',
            VERSA_BASEIRI + 'synonyms': VERSA_BASEIRI + 'resourceset'
        }
    }

    m = memory.connection(baseiri='http://example.org/')
    #from_markdown(VERSA_LITERATE1, m, encoding='utf-8')
    doc = open(os.path.join(RESOURCEPATH, 'ubibframe.md')).read()
    from_markdown(doc, m, config=config)
    logging.debug('VERSA LITERATE EXAMPLE 1')
    for link in m.match():
        logging.debug('Result: {0}'.format(repr(link)))
        #assert result == ()
    assert results == None, "Boo! "
Пример #6
0
def run(infile):
    m = memory.connection()
    from_markdown(infile.read(), m)
    #from versa.util import jsondump
    #jsondump(m, open('/tmp/foo.json', 'w'))
    print('<descriptionSet>')
    for poem in resources_by_type(m, 'http://uche.ogbuji.net/poems/poem'):
        choice = '@choice' in list(map(operator.itemgetter(TARGET), m.match(poem, 'http://www.w3.org/2005/Atom/category')))
        if not choice: continue
        print('<description>')
        d = parse_date(simple_lookup(m, poem, 'http://www.w3.org/2005/Atom/updated'))
        source = next(m.match(poem, 'http://www.w3.org/2005/Atom/source'))
        source = source[ATTRIBUTES]['title']
        title = simple_lookup(m, poem, 'http://www.w3.org/2005/Atom/title')
        print('  <title>{0}</title>\n  <date>{1}</date>\n  <publisher>{2}</publisher>'.format(title, d.strftime('%B, %Y'), source))
        hlink = list(map(operator.itemgetter(TARGET), m.match(poem, 'http://www.w3.org/2005/Atom/link')))
        if hlink:
            hlink = hlink[0]
            print('  <link href="{0}"/>'.format(hlink))
        print('</description>')
    print('</descriptionSet>')