예제 #1
0
class Entity(rdfSubject):
    rdf_type = URIRef('urn:entity')

    additionalType = rdfSingle(schema.additionalType)

    label = rdfMultiple(RDFS.label)
    name = rdfMultiple(schema.name)
    alternateName = rdfMultiple(schema.alternateName)
    description = rdfMultiple(schema.description)

    mainEntityOfPage = rdfSingle(schema.mainEntityOfPage)
    sameAs = rdfMultiple(OWL.sameAs)

    disambiguatingDescription = rdfMultiple(schema.disambiguatingDescription)

    keywords = rdfMultiple(schema.keywords)

    depiction = rdfSingle(foaf.depiction)
    subjectOf = rdfMultiple(schema.subjectOf)
    about = rdfMultiple(schema.about)
    url = rdfSingle(schema.url)

    inDataset = rdfSingle(void.inDataset)

    hasTimeStamp = rdfSingle(sem.hasTimeStamp)
    hasEarliestBeginTimeStamp = rdfSingle(sem.hasEarliestBeginTimeStamp)
    hasLatestEndTimeStamp = rdfSingle(sem.hasLatestEndTimeStamp)
예제 #2
0
class PersonName(rdfSubject):
    rdf_type = pnv.PersonName
    label = rdfSingle(RDFS.label)

    literalName = rdfSingle(pnv.literalName)
    givenName = rdfSingle(pnv.givenName)
    surnamePrefix = rdfSingle(pnv.surnamePrefix)
    baseSurname = rdfSingle(pnv.baseSurname)

    prefix = rdfSingle(pnv.prefix)
    disambiguatingDescription = rdfSingle(pnv.disambiguatingDescription)
    patronym = rdfSingle(pnv.patronym)
    surname = rdfSingle(pnv.surname)

    nameSpecification = rdfSingle(pnv.nameSpecification)
예제 #3
0
class Book(Thing):
    rdf_type = schema.Book

    author = rdfMultiple(schema.author)
    inLanguage = rdfMultiple(schema.inLanguage)
    publication = rdfSingle(schema.publication)

    bibliographicFormat = rdfSingle(kbdef.bibliographicFormat)
    hasCollationalFormula = rdfSingle(kbdef.hasCollationalFormula)

    about = rdfMultiple(schema.about)

    numberOfPages = rdfSingle(schema.numberOfPages)

    workExample = rdfMultiple(schema.workExample)
예제 #4
0
class Derivation(rdfSubject):
    rdf_type = prov.Derivation
    label = rdfMultiple(RDFS.label)
    comment = rdfMultiple(RDFS.comment)

    hadActivity = rdfSingle(prov.hadActivity)
    entity = rdfMultiple(prov.entity)
예제 #5
0
class Entity(rdfSubject):
    rdf_type = prov.Entity
    label = rdfMultiple(RDFS.label)
    comment = rdfMultiple(RDFS.comment)

    wasDerivedFrom = rdfMultiple(prov.wasDerivedFrom)
    qualifiedDerivation = rdfSingle(prov.qualifiedDerivation,
                                    range_type=prov.Derivation)

    inDataset = rdfSingle(void.inDataset)

    hasLocation = rdfMultiple(roar.hasLocation)

    documentedIn = rdfSingle(roar.documentedIn)

    identifier = rdfSingle(schema.identifier)
예제 #6
0
class Location(rdfSubject):
    rdf_type = saa.Location
    isInRecord = rdfSingle(saa.isInRecord)

    label = rdfMultiple(RDFS.label)
    altLabel = rdfMultiple(skos.altLabel)
    sameAs = rdfMultiple(OWL.sameAs)
예제 #7
0
class Entity(rdfSubject):
    rdf_type = URIRef('urn:entity')

    label = rdfMultiple(RDFS.label)
    name = rdfMultiple(schema.name)
    url = rdfSingle(schema.url)

    hasGeometry = rdfSingle(geo.hasGeometry)

    startDate = rdfSingle(schema.startDate)
    hasTimeStamp = rdfSingle(sem.hasTimeStamp)
    hasBeginTimeStamp = rdfSingle(sem.hasBeginTimeStamp)
    hasEndTimeStamp = rdfSingle(sem.hasEndTimeStamp)
    hasEarliestBeginTimeStamp = rdfSingle(sem.hasEarliestBeginTimeStamp)
    hasLatestBeginTimeStamp = rdfSingle(sem.hasLatestBeginTimeStamp)
    hasEarliestEndTimeStamp = rdfSingle(sem.hasEarliestEndTimeStamp)
    hasLatestEndTimeStamp = rdfSingle(sem.hasLatestEndTimeStamp)
예제 #8
0
class StructuredValue(rdfSubject):
    value = rdfSingle(RDF.value)

    role = rdfSingle(roar.role)

    hasTimeStamp = rdfSingle(sem.hasTimeStamp)
    hasBeginTimeStamp = rdfSingle(sem.hasBeginTimeStamp)
    hasEndTimeStamp = rdfSingle(sem.hasEndTimeStamp)
    hasEarliestBeginTimeStamp = rdfSingle(sem.hasEarliestBeginTimeStamp)
    hasLatestBeginTimeStamp = rdfSingle(sem.hasLatestBeginTimeStamp)
    hasEarliestEndTimeStamp = rdfSingle(sem.hasEarliestEndTimeStamp)
    hasLatestEndTimeStamp = rdfSingle(sem.hasLatestEndTimeStamp)

    label = rdfMultiple(RDFS.label)
예제 #9
0
class Activity(rdfSubject):
    rdf_type = prov.Activity
    label = rdfMultiple(RDFS.label)
    comment = rdfMultiple(RDFS.comment)

    wasAssociatedWith = rdfMultiple(prov.wasAssociatedWith,
                                    range_type=prov.Agent)
    qualifiedAssociation = rdfSingle(prov.qualifiedAssociation,
                                     range_type=prov.Association)
예제 #10
0
class Adres(Entity):
    rdf_type = lpOnt.Adres

    label = rdfSingle(RDFS.label)  # Literal
    prefLabel = rdfSingle(SKOS.prefLabel)  # Literal

    straat = rdfSingle(lpOnt.straat)  # URI
    huisnummer = rdfSingle(lpOnt.huisnummer)  # Literal
    huisnummertoevoeging = rdfSingle(lpOnt.huisnummertoevoeging)  # Literal

    buurt = rdfSingle(lpOnt.buurt)  # URI
    buurtnummer = rdfSingle(lpOnt.buurtnummer)  # Literal
    buurtnummertoevoeging = rdfSingle(lpOnt.buurtnummertoevoeging)  # Literal

    perceel = rdfSingle(lpOnt.perceel)  # URI
예제 #11
0
class PersonName(Thing):
    rdf_type = pnv.PersonName

    # These map to A2A
    literalName = rdfSingle(pnv.literalName)
    givenName = rdfSingle(pnv.givenName)
    surnamePrefix = rdfSingle(pnv.surnamePrefix)
    baseSurname = rdfSingle(pnv.baseSurname)
    initials = rdfSingle(pnv.initials)

    # These do not
    prefix = rdfSingle(pnv.prefix)
    disambiguatingDescription = rdfSingle(pnv.disambiguatingDescription)
    patronym = rdfSingle(pnv.patronym)
    surname = rdfSingle(pnv.surname)
예제 #12
0
class PersonName(rdfSubject):
    rdf_type = pnv.PersonName

    # These map to A2A
    literalName = rdfSingle(pnv.literalName)
    givenName = rdfSingle(pnv.givenName)
    surnamePrefix = rdfSingle(pnv.surnamePrefix)
    baseSurname = rdfSingle(pnv.baseSurname)

    prefix = rdfSingle(pnv.prefix)
    disambiguatingDescription = rdfSingle(pnv.disambiguatingDescription)
    patronym = rdfSingle(pnv.patronym)
    surname = rdfSingle(pnv.surname)
예제 #13
0
class VisualArtwork(CreativeWork):
    rdf_type = schema.VisualArtwork, schema.Product

    artist = rdfMultiple(schema.artist)

    dateCreated = rdfSingle(schema.dateCreated)
    dateModified = rdfSingle(schema.dateModified)

    temporal = rdfMultiple(schema.temporal)

    artworkSurface = rdfMultiple(schema.artworkSurface)
    artMedium = rdfMultiple(schema.artMedium)
    artform = rdfMultiple(schema.artform)

    width = rdfSingle(schema.width)
    height = rdfSingle(schema.height)
    depth = rdfSingle(schema.depth)
    image = rdfMultiple(schema.image)

    subject = rdfMultiple(dc.subject)
예제 #14
0
class DurationDescription(GeneralDurationDescription):
    rdf_type = Namespace('http://www.w3.org/2006/time#').DurationDescription

    hours = rdfSingle(Namespace('http://www.w3.org/2006/time#').hours)
    minutes = rdfSingle(Namespace('http://www.w3.org/2006/time#').minutes)
    weeks = rdfSingle(Namespace('http://www.w3.org/2006/time#').weeks)
    seconds = rdfSingle(Namespace('http://www.w3.org/2006/time#').seconds)
    months = rdfSingle(Namespace('http://www.w3.org/2006/time#').months)
    years = rdfSingle(Namespace('http://www.w3.org/2006/time#').years)
    days = rdfSingle(Namespace('http://www.w3.org/2006/time#').days)
class Duration(TemporalDuration):
    rdf_type = Namespace('http://www.w3.org/2006/time#').Duration

    numericDuration = rdfSingle(
        Namespace('http://www.w3.org/2006/time#').numericDuration)

    unitTypeExactlyThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').unitTypeExactlyThing)
    listOfunitTypeExactlyThing = []

    def addunitTypeExactly(self, parameter):
        self.listOfunitTypeExactlyThing.append(parameter)
        self.unitTypeExactlyThing = self.listOfunitTypeExactlyThing
예제 #16
0
class Record(rdfSubject):
    rdf_type = ga.IndexOpBegraafregisters

    identifier = rdfSingle(saa.identifier)
    sourceReference = rdfSingle(saa.sourceReference)
    inventoryNumber = rdfSingle(saa.inventoryNumber)
    urlScan = rdfSingle(saa.urlScan)
    mentionsRegisteredName = rdfMultiple(saa.mentionsRegisteredName)
    mentionsBuriedName = rdfMultiple(saa.mentionsBuriedName)
    relationInformation = rdfSingle(saa.relationInformation)
    cemetery = rdfSingle(saa.cemetery)
    burialDate = rdfSingle(saa.burialDate)
예제 #17
0
class Measurement(rdfSubject):
    rdf_type = Namespace('https://w3id.org/saref#').Measurement

    hasTimestamp = rdfSingle(Namespace('https://w3id.org/saref#').hasTimestamp)
    hasValue = rdfSingle(Namespace('https://w3id.org/saref#').hasValue)

    isMeasuredInExactlyUnitOfMeasure = rdfList(
        Namespace('https://w3id.org/saref#').isMeasuredInExactlyUnitOfMeasure)
    listOfisMeasuredInExactlyUnitOfMeasure = []

    def addisMeasuredInExactly(self, parameter):
        self.listOfisMeasuredInExactlyUnitOfMeasure.append(parameter)
        self.isMeasuredInExactlyUnitOfMeasure = self.listOfisMeasuredInExactlyUnitOfMeasure

    isMeasuredInOnlyUnitOfMeasure = rdfList(
        Namespace('https://w3id.org/saref#').isMeasuredInOnlyUnitOfMeasure)
    listOfisMeasuredInOnlyUnitOfMeasure = []

    def addisMeasuredInOnly(self, parameter):
        self.listOfisMeasuredInOnlyUnitOfMeasure.append(parameter)
        self.isMeasuredInOnlyUnitOfMeasure = self.listOfisMeasuredInOnlyUnitOfMeasure

    relatesToPropertyExactlyProperty = rdfList(
        Namespace('https://w3id.org/saref#').relatesToPropertyExactlyProperty)
    listOfrelatesToPropertyExactlyProperty = []

    def addrelatesToPropertyExactly(self, parameter):
        self.listOfrelatesToPropertyExactlyProperty.append(parameter)
        self.relatesToPropertyExactlyProperty = self.listOfrelatesToPropertyExactlyProperty

    relatesToPropertyOnlyProperty = rdfList(
        Namespace('https://w3id.org/saref#').relatesToPropertyOnlyProperty)
    listOfrelatesToPropertyOnlyProperty = []

    def addrelatesToPropertyOnly(self, parameter):
        self.listOfrelatesToPropertyOnlyProperty.append(parameter)
        self.relatesToPropertyOnlyProperty = self.listOfrelatesToPropertyOnlyProperty
예제 #18
0
class GeneralDateTimeDescription(TemporalPosition):
    rdf_type = Namespace(
        'http://www.w3.org/2006/time#').GeneralDateTimeDescription

    day = rdfSingle(Namespace('http://www.w3.org/2006/time#').day)
    dayOfYear = rdfSingle(Namespace('http://www.w3.org/2006/time#').dayOfYear)
    hour = rdfSingle(Namespace('http://www.w3.org/2006/time#').hour)
    week = rdfSingle(Namespace('http://www.w3.org/2006/time#').week)
    month = rdfSingle(Namespace('http://www.w3.org/2006/time#').month)
    minute = rdfSingle(Namespace('http://www.w3.org/2006/time#').minute)
    year = rdfSingle(Namespace('http://www.w3.org/2006/time#').year)
    second = rdfSingle(Namespace('http://www.w3.org/2006/time#').second)

    monthOfYearMaxThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').monthOfYearMaxThing)
    listOfmonthOfYearMaxThing = []

    def addmonthOfYearMax(self, parameter):
        self.listOfmonthOfYearMaxThing.append(parameter)
        self.monthOfYearMaxThing = self.listOfmonthOfYearMaxThing

    unitTypeExactlyThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').unitTypeExactlyThing)
    listOfunitTypeExactlyThing = []

    def addunitTypeExactly(self, parameter):
        self.listOfunitTypeExactlyThing.append(parameter)
        self.unitTypeExactlyThing = self.listOfunitTypeExactlyThing

    timeZoneMaxThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').timeZoneMaxThing)
    listOftimeZoneMaxThing = []

    def addtimeZoneMax(self, parameter):
        self.listOftimeZoneMaxThing.append(parameter)
        self.timeZoneMaxThing = self.listOftimeZoneMaxThing

    dayOfWeekMaxThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').dayOfWeekMaxThing)
    listOfdayOfWeekMaxThing = []

    def adddayOfWeekMax(self, parameter):
        self.listOfdayOfWeekMaxThing.append(parameter)
        self.dayOfWeekMaxThing = self.listOfdayOfWeekMaxThing
예제 #19
0
class Person(Entity):
    rdf_type = schema.Person

    birthPlace = rdfSingle(schema.birthPlace)
    deathPlace = rdfSingle(schema.deathPlace)

    birthDate = rdfSingle(schema.birthDate)
    deathDate = rdfSingle(schema.deathDate)

    birth = rdfSingle(bio.birth)
    death = rdfSingle(bio.death)
    event = rdfMultiple(bio.event)

    spouse = rdfMultiple(schema.spouse)
    parent = rdfMultiple(schema.parent)
    children = rdfMultiple(schema.children)

    gender = rdfSingle(schema.gender)
예제 #20
0
class GeneralDurationDescription(TemporalDuration):
    rdf_type = Namespace(
        'http://www.w3.org/2006/time#').GeneralDurationDescription

    seconds = rdfSingle(Namespace('http://www.w3.org/2006/time#').seconds)
    minutes = rdfSingle(Namespace('http://www.w3.org/2006/time#').minutes)
    hours = rdfSingle(Namespace('http://www.w3.org/2006/time#').hours)
    months = rdfSingle(Namespace('http://www.w3.org/2006/time#').months)
    days = rdfSingle(Namespace('http://www.w3.org/2006/time#').days)
    years = rdfSingle(Namespace('http://www.w3.org/2006/time#').years)
    weeks = rdfSingle(Namespace('http://www.w3.org/2006/time#').weeks)

    hasTRSExactlyThing = rdfList(
        Namespace('http://www.w3.org/2006/time#').hasTRSExactlyThing)
    listOfhasTRSExactlyThing = []

    def addhasTRSExactly(self, parameter):
        self.listOfhasTRSExactlyThing.append(parameter)
        self.hasTRSExactlyThing = self.listOfhasTRSExactlyThing
예제 #21
0
class Command(rdfSubject):
    rdf_type = Namespace('https://w3id.org/saref#').Command

    hasDescription = rdfSingle(
        Namespace('https://w3id.org/saref#').hasDescription)

    isCommandOfMinFunction = rdfList(
        Namespace('https://w3id.org/saref#').isCommandOfMinFunction)
    listOfisCommandOfMinFunction = []

    def addisCommandOfMin(self, parameter):
        self.listOfisCommandOfMinFunction.append(parameter)
        self.isCommandOfMinFunction = self.listOfisCommandOfMinFunction

    actsUponOnlyState = rdfList(
        Namespace('https://w3id.org/saref#').actsUponOnlyState)
    listOfactsUponOnlyState = []

    def addactsUponOnly(self, parameter):
        self.listOfactsUponOnlyState.append(parameter)
        self.actsUponOnlyState = self.listOfactsUponOnlyState
예제 #22
0
class Scan(rdfSubject):
    rdf_type = (saa.Scan, AS.OrderedCollectionPage)

    # partOf a collection

    depiction = rdfSingle(foaf.depiction)

    imageFilename = rdfSingle(saa.imageFilename)
    imageWidth = rdfSingle(saa.imageWidth)
    imageHeight = rdfSingle(saa.imageHeight)

    regions = rdfMultiple(saa.regions)

    items = rdfList(AS.items)  # rdf:Collection
    prev = rdfSingle(AS.prev)
    next = rdfSingle(AS.next)
예제 #23
0
## list Companies
for c in Company.ClassInstances():
    print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
print('')


def test_2():
    ## Add a descriptor on the fly
    Company.stockDescription = rdfSingle(OV.stockDescription,
                                         'stockDescription')
    assert c.companyName == c[OV.companyName]


## add another descriptor on the fly
Company.industry = rdfSingle(OV.yindustry, 'industry')

## add an attribute (from the database)
c = Company.get_by(symbol='JAVA')
c.industry = 'Computer stuff'


def test_3():
    ## delete an attribute (from the database)
    c = Company.get_by(symbol='IBM')
    assert c.industry == "Diversified Computer Systems"
    del c.industry
    assert c.industry != "Diversified Computer Systems"
    c = Company.get_by(symbol='IBM')
    assert not c.industry
예제 #24
0
# encoding: utf-8
import rdfalchemy
from rdfalchemy.rdfSubject import rdfSubject
from rdfalchemy.descriptors import rdfLocale
from rdfalchemy.samples.doap import DOAP, Project
import platform

if platform.system() == "Java":
    from nose import SkipTest

    raise SkipTest("Skipping, Java - Python unicode conflict")

rdfSubject.db.parse("rdfalchemy/samples/schema/doap.rdf")
p = Project(DOAP.SVNRepository)

Project.ls = rdfalchemy.rdfSingle(rdfalchemy.RDFS.label, cacheName="ls")
Project.lm = rdfalchemy.rdfMultiple(rdfalchemy.RDFS.label, cacheName="lm")
Project.len = rdfLocale(rdfalchemy.RDFS.label, "en")
Project.les = rdfLocale(rdfalchemy.RDFS.label, "es")
Project.lfr = rdfLocale(rdfalchemy.RDFS.label, "fr")


def en_es_test():
    assert p.len == u"Subversion Repository", p.len
    assert p.les == u"Repositorio Subversion"
    assert p.lfr == u"D\xe9p\xf4t Subversion"


# unkown resp
print(repr(p.ls))
print(repr(p.lm))
예제 #25
0
class Church(rdfSubject):
    rdf_type = ga.Church

    label = rdfSingle(RDFS.label)
예제 #26
0
def test_2():
    ## Add a descriptor on the fly
    Company.stockDescription = rdfSingle(OV.stockDescription, 'stockDescription')
    assert  c.companyName == c[OV.companyName]
예제 #27
0
    assert c.symbol == "IBM"

## list Companies
for c in Company.ClassInstances():
    print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
print('')


def test_2():
    ## Add a descriptor on the fly
    Company.stockDescription = rdfSingle(OV.stockDescription, 'stockDescription')
    assert  c.companyName == c[OV.companyName]


## add another descriptor on the fly
Company.industry = rdfSingle(OV.yindustry, 'industry')

## add an attribute (from the database)
c = Company.get_by(symbol='JAVA')
c.industry = 'Computer stuff'


def test_3():
    ## delete an attribute (from the database)
    c = Company.get_by(symbol='IBM')
    assert c.industry == "Diversified Computer Systems"
    del c.industry
    assert c.industry != "Diversified Computer Systems"
    c = Company.get_by(symbol='IBM')
    assert not c.industry
예제 #28
0
파일: doap.py 프로젝트: pdwood/RDFAlchemy3
class Release(rdfSubject):
    rdf_type = DOAP.Version
    name = rdfSingle(DOAP.revision)
    created = rdfSingle(DOAP.created)
    shortdesc = rdfMultiple(DOAP.shortdesc)
    file_releases = rdfMultiple(DOAP['file-release'])
예제 #29
0
class Dataset(rdfSubject):
    """Dataset class, both a schema:Dataset and a void:Dataset.

    Indicate at least:
        * name (name of the dataset, str)
        * description (detailed description (Markdown allowed), str)

    See also: https://developers.google.com/search/docs/data-types/dataset
    """

    rdf_type = void.Dataset, schema.Dataset
    label = rdfMultiple(RDFS.label)

    ##########
    # schema #
    ##########

    name = rdfMultiple(schema.name)
    description = rdfMultiple(schema.description)
    alternateName = rdfMultiple(schema.alternateName)
    creator = rdfMultiple(schema.creator,
                          range_type=(schema.Person, schema.Organization))
    citation = rdfMultiple(schema.citation,
                           range_type=(Literal, schema.CreativeWork))
    hasPart = rdfMultiple(schema.hasPart, range_type=(URIRef, schema.Dataset))
    isPartOf = rdfSingle(schema.isPartOf, range_type=(URIRef, schema.Dataset))
    identifier = rdfMultiple(schema.identifier,
                             range_type=(URIRef, Literal,
                                         schema.PropertyValue))
    keywords = rdfMultiple(schema.keywords, range_type=Literal)
    licenseprop = rdfSingle(schema.license,
                            range_type=(URIRef, schema.CreativeWork))
    sameAs = rdfMultiple(schema.sameAs, range_type=URIRef)
    spatialCoverage = rdfMultiple(schema.spatialCoverage,
                                  range_type=(Literal, schema.Place))
    temporalCoverage = rdfMultiple(schema.temporalCoverage, range_type=Literal)
    variableMeasured = rdfMultiple(schema.variableMeasured,
                                   range_type=(Literal, schema.PropertyValue))
    version = rdfMultiple(schema.sameAs, range_type=Literal)
    url = rdfMultiple(schema.url, range_type=URIRef)

    distribution = rdfMultiple(schema.distribution,
                               range_type=schema.DataDownload)
    dateModified = rdfSingle(schema.dateModified)

    image = rdfSingle(schema.image, range_type=URIRef)

    ########
    # void #
    ########

    dctitle = rdfMultiple(dcterms.title)
    dcdescription = rdfMultiple(dcterms.description)
    dccreator = rdfMultiple(dcterms.creator)
    dcpublisher = rdfMultiple(dcterms.publisher)
    dccontributor = rdfMultiple(dcterms.contributor)
    dcsource = rdfSingle(dcterms.source)
    dcdate = rdfSingle(dcterms.date)
    dccreated = rdfSingle(dcterms.created)
    dcissued = rdfSingle(dcterms.issued)
    dcmodified = rdfSingle(dcterms.modified)

    dataDump = rdfSingle(void.dataDump)
    sparqlEndpoint = rdfSingle(void.sparqlEndpoint)
    exampleResource = rdfSingle(void.exampleResource)
    vocabulary = rdfMultiple(void.vocabulary)
    triples = rdfSingle(void.triples)

    inDataset = rdfSingle(void.inDataset)
    subset = rdfMultiple(void.subset)
예제 #30
0
class Company(rdfSubject):
    rdf_type = OV.Company
    symbol = rdfSingle(OV.symbol, 'symbol')
    cik = rdfSingle(OV.secCik, 'cik')
    companyName = rdfSingle(OV.companyName)
    address = rdfSingle(VCARD.adr)
예제 #31
0
c = Company.get_by(symbol='IBM')
## this will enable us to see that the reads are cached

log = logging.getLogger('rdfAlchemy')
## comment out to quiet debug messages
log.setLevel(logging.DEBUG)

## list Companies
for c in Company.ClassInstances():
    print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
print('')

c = Company.get_by(symbol='IBM')

## Add a descriptor on the fly
Company.stockDescription = rdfSingle(OV.stockDescription, 'stockDescription')

print("%s: %s" % (c.companyName, c.stockDescription))
print(" same as")
print("%s: %s" % (c[OV.companyName], c[OV.stockDescription]))

print("## CHECK to see if multiple reads cause database reads")
print("   you should see no non-blank lines between here\n")
s = "%s: %s" % (c.companyName, c.stockDescription)
s = "%s: %s" % (c.companyName, c.stockDescription)
print("\n   and here")

c = Company.get_by(symbol='IBM')
print("   and exactly the same number of non-blank lines between here\n")
s = "%s: %s" % (c.companyName, c.stockDescription)
print("\n   and here")
예제 #32
0
def test_2():
    ## Add a descriptor on the fly
    Company.stockDescription = rdfSingle(OV.stockDescription,
                                         'stockDescription')
    assert c.companyName == c[OV.companyName]
예제 #33
0
c = Company.get_by(symbol='IBM')
## this will enable us to see that the reads are cached

log = logging.getLogger('rdfAlchemy')
## comment out to quiet debug messages
log.setLevel(logging.DEBUG)

## list Companies
for c in Company.ClassInstances():
    print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
print('')

c = Company.get_by(symbol='IBM')

## Add a descriptor on the fly
Company.stockDescription = rdfSingle(OV.stockDescription, 'stockDescription')

print("%s: %s" % (c.companyName, c.stockDescription))
print(" same as")
print("%s: %s" % (c[OV.companyName], c[OV.stockDescription]))

print("## CHECK to see if multiple reads cause database reads")
print("   you should see no non-blank lines between here\n")
s = "%s: %s" % (c.companyName, c.stockDescription)
s = "%s: %s" % (c.companyName, c.stockDescription)
print("\n   and here")

c = Company.get_by(symbol='IBM')
print("   and exactly the same number of non-blank lines between here\n")
s = "%s: %s" % (c.companyName, c.stockDescription)
print("\n   and here")
예제 #34
0
class EdgarFiling(rdfSubject):
    rdf_type = edgarns.xbrlFiling
    accessionNumber = rdfSingle(edgarns.accessionNumber)
    companyName = rdfSingle(edgarns.companyName)
    filingDate = rdfSingle(edgarns.filingDate)
    formType = rdfSingle(edgarns.formType)
예제 #35
0

## list Companies
for c in Company.ClassInstances():
    print("%s has an SEC symbol of %s" % (c.companyName, c.cik))
print("")


def test_2():
    ## Add a descriptor on the fly
    Company.stockDescription = rdfSingle(OV.stockDescription, "stockDescription")
    assert c.companyName == c[OV.companyName]


## add another descriptor on the fly
Company.industry = rdfSingle(OV.yindustry, "industry")

## add an attribute (from the database)
c = Company.get_by(symbol="JAVA")
c.industry = "Computer stuff"


def test_3():
    ## delete an attribute (from the database)
    c = Company.get_by(symbol="IBM")
    assert c.industry == "Diversified Computer Systems"
    del c.industry
    assert c.industry != "Diversified Computer Systems"
    c = Company.get_by(symbol="IBM")
    assert not c.industry