def test_close_multiples_stores(self): """ Test that closing a session with multiple stores work. """ store1 = Store() session = Session(store1) store2 = Store() session["store2"] = store2 # Should not fail. session.close()
def test_close_multiples_stores(): """ Test that closing a session with multiple stores work. """ try: store1 = Store() session = Session(store1) store2 = Store() session["store2"] = store2 # Should not fail. session.close() except Exception as e: pytest.fail(error_message(e), pytrace=True)
def test_close_multiples_stores(): """ Test that closing a session with multiple stores work. """ try: store1 = Store() session = Session(store1) store2 = Store() session["store2"] = store2 # Should not fail. session.close() except Exception, e: pytest.fail(e.message, pytrace=True)
def export_csv(): store = Store(reader='rdflib', writer='rdflib', rdflib_store='IOMemory') session = Session(store) print 'Load HEP data' store.load_triples(source='HEPont.rdf') Concept = session.get_class(namespace.SKOS['Concept']) all_concepts = Concept.all() print 'Found %d concepts' % (len(all_concepts)) for concept in all_concepts: try: concept_uri = concept.subject concept_prefLabel = concept.skos_prefLabel.first print '%s;%s' % (concept_uri, concept_prefLabel) except: pass
def test_multiples(self): """ Test synchronization between empty attribute and rdf_direct. """ store = Store() session = Session(store) Person = session.get_class(surf.ns.FOAF.Person) rob = session.get_resource("http://Robert", Person) rob.foaf_name = "Robert" michael = session.get_resource("http://Michael", Person) michael.foaf_name = "Michael" # Should not fail. store.save(rob, michael) store.update(rob, michael) store.remove(rob, michael)
def test_multiples(self): """ Test synchronization between empty attribute and rdf_direct. """ store = Store(log_level=logging.NOTSET) session = Session(store) Person = session.get_class(surf.ns.FOAF.Person) rob = session.get_resource("http://Robert", Person) rob.foaf_name = "Robert" michael = session.get_resource("http://Michael", Person) michael.foaf_name = "Michael" # Should not fail. store.save(rob, michael) store.update(rob, michael) store.remove(rob, michael)
def test_multiples(): """ Test synchronization between empty attribute and rdf_direct. """ store = Store(log_level=logging.NOTSET) session = Session(store) Person = session.get_class(surf.ns.FOAF.Person) rob = session.get_resource("http://Robert", Person) rob.foaf_name = "Robert" michael = session.get_resource("http://Michael", Person) michael.foaf_name = "Michael" try: store.save(rob, michael) store.update(rob, michael) store.remove(rob, michael) except Exception, e: pytest.fail(e.message, pytrace=True)
#!/usr/bin/env python __author__ = 'Adam R. Smith' __license__ = 'Apache 2.0' from surf import Store, Session, ns store = Store(reader='rdflib', writer='rdflib', rdflib_store='IOMemory') session = Session(store) print 'Load RDF data' store.load_triples(source='http://www.w3.org/People/Berners-Lee/card.rdf') Person = session.get_class(ns.FOAF['Person']) all_persons = Person.all() print 'Found %d persons that Tim Berners-Lee knows' % (len(all_persons)) for person in all_persons: print person.foaf_name.first #create a person object somebody = Person() somebody_else = Person() somebody.foaf_knows = somebody_else
#!/usr/bin/env python __author__ = 'Adam R. Smith' from surf import Store, Session, ns store = Store(reader='rdflib', writer='rdflib', rdflib_store = 'IOMemory') session = Session(store) print 'Load RDF data' store.load_triples(source='http://www.w3.org/People/Berners-Lee/card.rdf') Person = session.get_class(ns.FOAF['Person']) all_persons = Person.all() print 'Found %d persons that Tim Berners-Lee knows'%(len(all_persons)) for person in all_persons: print person.foaf_name.first #create a person object somebody = Person() somebody_else = Person() somebody.foaf_knows = somebody_else