Mercurial > hg > audio-features-catalogue
comparison rdfpy/writeBaseOnto.py @ 18:d5012016bf64 tip
added rdfpy and rdfonto directories
| author | nothing@tehis.net |
|---|---|
| date | Tue, 23 Apr 2013 11:49:20 +0100 |
| parents | 53069717108c |
| children |
comparison
equal
deleted
inserted
replaced
| 17:2b5c292ad12f | 18:d5012016bf64 |
|---|---|
| 108 graph.bind('owl', URIRef('http://www.w3.org/2002/07/owl#')) | 108 graph.bind('owl', URIRef('http://www.w3.org/2002/07/owl#')) |
| 109 graph.bind('xsd', URIRef('http://www.w3.org/2001/XMLSchema#')) | 109 graph.bind('xsd', URIRef('http://www.w3.org/2001/XMLSchema#')) |
| 110 graph.bind('vs', URIRef('http://www.w3.org/2003/06/sw-vocab-status/ns#')) | 110 graph.bind('vs', URIRef('http://www.w3.org/2003/06/sw-vocab-status/ns#')) |
| 111 | 111 |
| 112 | 112 |
| 113 | |
| 114 ######################## | 113 ######################## |
| 115 ####### header ######### | 114 ####### header ######### |
| 116 ######################## | 115 ######################## |
| 117 | 116 |
| 118 graph.add(( | 117 graph.add(( |
| 589 domain=URIRef(local + "AudioFeature"), | 588 domain=URIRef(local + "AudioFeature"), |
| 590 label="application_domain property", | 589 label="application_domain property", |
| 591 comment="application domain: mir, speech, environmental, etc." | 590 comment="application domain: mir, speech, environmental, etc." |
| 592 ) | 591 ) |
| 593 | 592 |
| 593 bnode = BNode() | |
| 594 Restriction(URIRef(local + "application_domain"),graph,someValuesFrom=URIRef(local + 'ApplicationDomain'),identifier=bnode) | |
| 595 graph.add(( | |
| 596 URIRef(local + "AudioFeature"), | |
| 597 RDFS.subClassOf, | |
| 598 bnode | |
| 599 )) | |
| 600 | |
| 594 # property: semantic_interpretation | 601 # property: semantic_interpretation |
| 595 addProperty( | 602 addProperty( |
| 596 graph=graph, | 603 graph=graph, |
| 597 propID="semantic_interpretation", | 604 propID="semantic_interpretation", |
| 598 type=OWL.ObjectProperty, | 605 type=OWL.ObjectProperty, |
| 600 domain=URIRef(local + "AudioFeature"), | 607 domain=URIRef(local + "AudioFeature"), |
| 601 label="semantic_interpretation property", | 608 label="semantic_interpretation property", |
| 602 comment="semantic interpretation: physical/perceptual" | 609 comment="semantic interpretation: physical/perceptual" |
| 603 ) | 610 ) |
| 604 | 611 |
| 612 bnode = BNode() | |
| 613 Restriction(URIRef(local + "semantic_interpretation"),graph,allValuesFrom=URIRef(local + 'SemanticInterpretation'),identifier=bnode) | |
| 614 graph.add(( | |
| 615 URIRef(local + "AudioFeature"), | |
| 616 RDFS.subClassOf, | |
| 617 bnode | |
| 618 )) | |
| 619 | |
| 620 bnode = BNode() | |
| 621 Restriction(URIRef(local + "semantic_interpretation"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 622 graph.add(( | |
| 623 URIRef(local + "AudioFeature"), | |
| 624 RDFS.subClassOf, | |
| 625 bnode | |
| 626 )) | |
| 627 | |
| 605 # property: computational_complexity | 628 # property: computational_complexity |
| 606 addProperty( | 629 addProperty( |
| 607 graph=graph, | 630 graph=graph, |
| 608 propID="computational_complexity", | 631 propID="computational_complexity", |
| 609 type=OWL.ObjectProperty, | 632 type=OWL.ObjectProperty, |
| 611 domain=URIRef(local + "AudioFeature"), | 634 domain=URIRef(local + "AudioFeature"), |
| 612 label="computational_complexity property", | 635 label="computational_complexity property", |
| 613 comment="computational complexity: high/medium/low" | 636 comment="computational complexity: high/medium/low" |
| 614 ) | 637 ) |
| 615 | 638 |
| 639 bnode = BNode() | |
| 640 Restriction(URIRef(local + "computational_complexity"),graph,allValuesFrom=URIRef(local + 'ComputationalComplexity'),identifier=bnode) | |
| 641 graph.add(( | |
| 642 URIRef(local + "AudioFeature"), | |
| 643 RDFS.subClassOf, | |
| 644 bnode | |
| 645 )) | |
| 646 | |
| 647 bnode = BNode() | |
| 648 Restriction(URIRef(local + "computational_complexity"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 649 graph.add(( | |
| 650 URIRef(local + "AudioFeature"), | |
| 651 RDFS.subClassOf, | |
| 652 bnode | |
| 653 )) | |
| 654 | |
| 616 # property: psychoacoustic_model | 655 # property: psychoacoustic_model |
| 617 addProperty( | 656 addProperty( |
| 618 graph=graph, | 657 graph=graph, |
| 619 propID="psychoacoustic_model", | 658 propID="psychoacoustic_model", |
| 620 type=OWL.ObjectProperty, | 659 type=OWL.ObjectProperty, |
| 622 domain=URIRef(local + "AudioFeature"), | 661 domain=URIRef(local + "AudioFeature"), |
| 623 label="psychoacoustic_model property", | 662 label="psychoacoustic_model property", |
| 624 comment="psychoacoustic model: true/false" | 663 comment="psychoacoustic model: true/false" |
| 625 ) | 664 ) |
| 626 | 665 |
| 666 bnode = BNode() | |
| 667 Restriction(URIRef(local + "psychoacoustic_model"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 668 graph.add(( | |
| 669 URIRef(local + "AudioFeature"), | |
| 670 RDFS.subClassOf, | |
| 671 bnode | |
| 672 )) | |
| 673 | |
| 627 # property: temporal_scale | 674 # property: temporal_scale |
| 628 addProperty( | 675 addProperty( |
| 629 graph=graph, | 676 graph=graph, |
| 630 propID="temporal_scale", | 677 propID="temporal_scale", |
| 631 type=OWL.ObjectProperty, | 678 type=OWL.ObjectProperty, |
| 633 domain=URIRef(local + "AudioFeature"), | 680 domain=URIRef(local + "AudioFeature"), |
| 634 label="temporal_scale", | 681 label="temporal_scale", |
| 635 comment="temporal scale: global, interframe, intraframe" | 682 comment="temporal scale: global, interframe, intraframe" |
| 636 ) | 683 ) |
| 637 | 684 |
| 685 bnode = BNode() | |
| 686 Restriction(URIRef(local + "temporal_scale"),graph,allValuesFrom=URIRef(local + 'TemporalScale'),identifier=bnode) | |
| 687 graph.add(( | |
| 688 URIRef(local + "AudioFeature"), | |
| 689 RDFS.subClassOf, | |
| 690 bnode | |
| 691 )) | |
| 692 | |
| 693 bnode = BNode() | |
| 694 Restriction(URIRef(local + "temporal_scale"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 695 graph.add(( | |
| 696 URIRef(local + "AudioFeature"), | |
| 697 RDFS.subClassOf, | |
| 698 bnode | |
| 699 )) | |
| 700 | |
| 701 | |
| 638 # property: dimensions | 702 # property: dimensions |
| 639 addProperty( | 703 addProperty( |
| 640 graph=graph, | 704 graph=graph, |
| 641 propID="dimensions", | 705 propID="dimensions", |
| 642 type=OWL.ObjectProperty, | 706 type=OWL.ObjectProperty, |
| 644 domain=URIRef(local + "AudioFeature"), | 708 domain=URIRef(local + "AudioFeature"), |
| 645 label="dimensions property", | 709 label="dimensions property", |
| 646 comment="dimensions: an integer value" | 710 comment="dimensions: an integer value" |
| 647 ) | 711 ) |
| 648 | 712 |
| 713 bnode = BNode() | |
| 714 Restriction(URIRef(local + "dimensions"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 715 graph.add(( | |
| 716 URIRef(local + "AudioFeature"), | |
| 717 RDFS.subClassOf, | |
| 718 bnode | |
| 719 )) | |
| 720 | |
| 649 # property: computation | 721 # property: computation |
| 650 addProperty( | 722 addProperty( |
| 651 graph=graph, | 723 graph=graph, |
| 652 propID="computation", | 724 propID="computation", |
| 653 type=OWL.ObjectProperty, | 725 type=OWL.ObjectProperty, |
| 655 domain=URIRef(local + "AudioFeature"), | 727 domain=URIRef(local + "AudioFeature"), |
| 656 label="computation", | 728 label="computation", |
| 657 comment="computation: a sequence of mathematical operations" | 729 comment="computation: a sequence of mathematical operations" |
| 658 ) | 730 ) |
| 659 | 731 |
| 732 bnode = BNode() | |
| 733 Restriction(URIRef(local + "computation"),graph,allValuesFrom=URIRef(local + 'Computation'),identifier=bnode) | |
| 734 graph.add(( | |
| 735 URIRef(local + "AudioFeature"), | |
| 736 RDFS.subClassOf, | |
| 737 bnode | |
| 738 )) | |
| 739 | |
| 740 bnode = BNode() | |
| 741 Restriction(URIRef(local + "computation"),graph,maxCardinality=Literal(1, datatype=XSD.int),identifier=bnode) | |
| 742 graph.add(( | |
| 743 URIRef(local + "AudioFeature"), | |
| 744 RDFS.subClassOf, | |
| 745 bnode | |
| 746 )) | |
| 660 | 747 |
| 661 ############################# | 748 ############################# |
| 662 ####### add features ######## | 749 ####### add features ######## |
| 663 ############################# | 750 ############################# |
| 664 | 751 |
| 668 | 755 |
| 669 if name == order[domainIndex]: | 756 if name == order[domainIndex]: |
| 670 domain = domains[order[domainIndex]] | 757 domain = domains[order[domainIndex]] |
| 671 domainIndex += 1 | 758 domainIndex += 1 |
| 672 | 759 |
| 673 graph.add(( | 760 # graph.add(( |
| 674 URIRef(id), | 761 # URIRef(id), |
| 675 RDF.type, | 762 # RDF.type, |
| 676 URIRef(local + "AudioFeature") | 763 # URIRef(local + "AudioFeature") |
| 677 )) | |
| 678 | |
| 679 # graph.add(( | |
| 680 # URIRef(id), | |
| 681 # RDF.type, | |
| 682 # OWL.Class | |
| 683 # )) | 764 # )) |
| 765 | |
| 766 graph.add(( | |
| 767 URIRef(id), | |
| 768 RDF.type, | |
| 769 OWL.Class | |
| 770 )) | |
| 684 | 771 |
| 685 graph.add(( | 772 graph.add(( |
| 686 URIRef(id), | 773 URIRef(id), |
| 687 VS['term_status'], | 774 VS['term_status'], |
| 688 Literal("testing") | 775 Literal("testing") |
