Beispiel #1
0
    line = "-" * max(len(st), len(t))
    print(line)


c = Cluster()
session = c.connect()

# initialize the TraversalSource for the DSL using the DSE Python Driver
# https://github.com/datastax/python-dse-driver
killr = Graph().traversal(KillrVideoTraversalSource).withRemote(
    DSESessionRemoteGraphConnection(session, "killrvideo"))

print_header("Actors for Young Guns",
             "killr.movies('Young Guns').actors().values('name')")
for n in killr.movies("Young Guns").actors().values("name").toList():
    print(n)

print_header(
    "Ratings Distribution by Age for Young Guns",
    "killr.movies('Young Guns').ratings().distribution_for_ages(18, 40)")
ratingsByAge = killr.movies("Young Guns").ratings().distribution_for_ages(
    18, 40).next()
print(ratingsByAge)

print_header(
    "Failed Validation",
    "killr.movies('Young Guns').ratings().distribution_for_ages(17,40)")
try:
    killr.movies("Young Guns").ratings().distribution_for_ages(17, 40).next()
except ValueError as ve:
Beispiel #2
0
    if subtitle:
        st = "[" + subtitle + "]"
        print(st)

    line = "-" * max(len(st), len(t))
    print(line)

c = Cluster()
session = c.connect()

# initialize the TraversalSource for the DSL using the DSE Python Driver
# https://github.com/datastax/python-dse-driver
killr = Graph().traversal(KillrVideoTraversalSource).withRemote(DSESessionRemoteGraphConnection(session, "killrvideo"))

print_header("Actors for Young Guns", "killr.movies('Young Guns').actors().values('name')")
for n in killr.movies("Young Guns").actors().values("name").toList():
    print(n)

print_header("Ratings Distribution by Age for Young Guns", "killr.movies('Young Guns').ratings().distribution_for_ages(18, 40)")
ratingsByAge = killr.movies("Young Guns").ratings().distribution_for_ages(18, 40).next()
print(ratingsByAge)

print_header("Failed Validation", "killr.movies('Young Guns').ratings().distribution_for_ages(17,40)")
try:
    killr.movies("Young Guns").ratings().distribution_for_ages(17, 40).next()
except ValueError as ve:
    print(ve.args)

print_header("Five Recommendations for u460", "killr.users('u460').recommend(5, 7).values(KEY_TITLE)")
for r in killr.users("u460").recommend(5, 7).values(KEY_TITLE).toList():
    print(r)
Beispiel #3
0
    line = "-" * max(len(st), len(t))
    print(line)


c = Cluster()
session = c.connect()

# initialize the TraversalSource for the DSL using the DSE Python Driver
# https://github.com/datastax/python-dse-driver
killr = Graph().traversal(KillrVideoTraversalSource).withRemote(
    DSESessionRemoteGraphConnection(session, "killrvideo"))

print_header("Actors for Young Guns",
             "killr.movies('Young Guns').actors().values('name')")
for n in killr.movies("Young Guns").actors().values("name").toList():
    print(n)

print_header(
    "Ratings Distribution by Age for Young Guns",
    "killr.movies('Young Guns').ratings().distribution_for_ages(18, 40)")
ratingsByAge = killr.movies("Young Guns").ratings().distribution_for_ages(
    18, 40).next()
print(ratingsByAge)

print_header(
    "Failed Validation",
    "killr.movies('Young Guns').ratings().distribution_for_ages(17,40)")
try:
    killr.movies("Young Guns").ratings().distribution_for_ages(17, 40).next()
except ValueError as ve: