Full text
1. Introduction
Most existing online music site that offers only retrieval method based on the song metadata, for example, according to the artist's name, song's name or style to query. Music metadata based query methods require music metadata of the song the user want to query. So it increases the difficulty of search.
Miscellaneous features and changes are difficult to describe based solely on the metadata. Users may just remember listening to the song who caused melody, but do not understand additional information, therefore it's hard to retrieve the song wanted to be checked in these systems.
In addition, there is a complex relationship between music data. Music management system not only store the audio files and the author, title, time and other music metadata, but also need to store the audio feature vector, pictures, videos, site users' social relations, user reviews of music distribution label and other related data.
Between these data more complex association between such two songs have a similar cover other relations; there can be lyricist, composer, singer and other relations between the songs and the singer; the complex relationship between the sites concerned users; the users‟ favorites, songs‟ ratings, tagging and other acts between them.
Figure data model is a through vertex, edges and their attributes to represent and store information data model, all data operations on the diagram. Compared with other data model, data model has the following advantages: (1) Data structure allows us to more naturally to data modeling. In social networks (Social Network), geographic information systems (Geographic Information Systems) and other areas, the complex relationships between data modeling is an extremely important content. (2) Data query and modification can be conducted on graph data structure, figure lets users become highly abstract operation. (3) In the implementation process, the map database can use graph algorithms to perform specific operations, such as graph traversal, sub graph matching shortest paths. (4) The figure database because of its natural characteristics can be more naturally and view the data.
Map data management and query in recent years has become one of the hot areas of data management, complex relationship between music data makes it ideally suited for use graph data model to model. The relationship between music data and data deemed a big picture; a music track can be expressed as a figure vertex, similarity, cover the relationship between tracks and the like can be expressed in music track edge between the vertices. Similarly, the singer also be manifested as vertices in the graph, cooperative relationship between them can be naturally show a side of the singer vertex. User for track collection, scoring, playing tag behavior can be seen as the establishment of edges and vertices between the user track vertices.
Music data query is looking for bigger that satisfy a given predicate conditions subgraph.
2. Music Data Model
2.1. Logical data structure
Definition 1. The label: In the Gra-MM, each vertex (edge) with labels, used to represent the vertices (edge) type. For example, in the music database vertex labels can be Artist, Track, Band, Album means, etc., the edge of the label can be Sing, Cooperate, Similarity, etc. In this article, we also called vertex (edge) label the vertices (edge) type.
Definition 2. Properties: Property is a binary group (the attribute name, domain), the domain is the set of
attribute value. For example, in a music database, has the Artist tag vertex has the properties such as Name, Gender, Track type vertex has the Title, Genre and other metadata attributes used to describe the song. In addition to support content based music data Chad, with songs stored in a binary form for the type of vertex and the content of the File and store songs characteristic Feature attribute; Sing of the class type edge Performance Time, Performance Location properties, etc. Vertex and edge of attribute information enables the GraMM to express the music data of complex structure and semantics, but also makes the GraMM support based on the content of the music of Chad.
Definition 3. Music database schema: GraMM model is a group of seven elements ( , , , , , , )S S SN SE S S SS N E L L A , in the form of directed labeled graph, said SN one vertex set; S S SE N N is the edge set; SNL is a vertex labels; SEL is the edge of the label; : ( ) ( )S S SN S SEN L E L is the distribution of vertices and edges of the label function; SA is the set of properties which is supported by database; : ( ) ( )S SN SE SL L p A is from tags set to the attributes set function of power set, ()SpA is SA in its curtain set (the power set). Through S and S function, we can know that with the same label (edge) with which attributes to the zenith (Table 1).
In addition, the model S will meet the following two constraints: ① , , ( ) ( )S S S Sa N b N a b a b , means the pattern of different vertex must have different labels. ② 12, , ( , ) ( ) ( )S S S Sa E b E a b n n a b , means between two vertices in the mode of if there are more than one edge, then these edges must have different labels.
Figure 1 is a simplified music database model. This model defines the music database there are two types of the vertex and two types of edge, and the vertex of the attribute is given. In this paper, the first section 3 to use the method of demonstration to Chad for statements, so gives a example of simplified music database model is easy to understand, the model only defines three types of vertices and five types. In the actual application, defined in the schema will be more than three vertex types.
Table 1 The label and corresponding properties Label Properties Track Artist User Sing Similarity Like Title, Genre, File Name, Gender ID Performance Time Sim Follow Established Time Figure 1 is a simplified music database model. This model defines the music database there are two types of the vertex and two types of edge, and the vertex of the attribute is given. In this paper, the first section 3 to use the method of demonstration to Chad for statements, so gives a example of simplified music database model is easy to understand, the model only defines three types of vertices and five types. In the actual application, defined in the schema will be more than three vertex types.
Artist Track User Sing Similarity Rate Follow Like
Figure 1. A simplified music database model.
Definition 4. Music database instance: A music database meet mode ( , , , , , , )S S SN SE S S SS N E L L A is a directed labeled graph ( , , , , , , )NEG N E L L A , where N is a vertex set; E N N is the edge set; NL is the culmination of the label set; EL is the edge of the label; : ( ) ( )NEN L E L is for the vertices (edges) label distribution function; A is the database attribute set support; from the label set to an attribute set power set of functions, which is a screen set (power set) attribute collection; : ( ) { ( )| ( )}p A dom a a p A each ()pA element will map to all the properties of the elements of the Cartesian product (to be described convenience, here referred to 12( ) ( ) ( )kdom a dom a dom a as ()dom a , which 1()dom a is the range of property 1a ,through λ, ψ and Φ function, you can get the database each vertex (edge) of the property value.
Figure G and Mode S also exists a subjective function :f G S , the G vertex (edge) is mapped to the vertex S (Side): ① ( ), ( ) ( ( ( )))Sn N G n dom f n , ()dom a is the label of a domain. ② ( , ) ( ), ( ) ( ( ), ( ))e a b E G f e f a f b and ( ( ( )))eSdom f e .
Figure 2 shows an example and model mapping example. Vertex "Half of My Heart" festival holiday after subjective function mapped to the Track the vertices in the database schema; Vertex "Taylor Swift", "John Mayer" mapping to Artist vertex; The two sides in the instance is mapped to Sing.
Definition 5. Query graph: Query graph is a tuple ( , )QQG , which QG is an instance of a database schema, u is a vertex (edge) on u constraints
property value (predicate), is a series of predicate conjunctions, verbs include =, ≠, ≤, ≥ , <,> and other more relationships.
Artist Track Taylor Swift Sing Half of My Heart John Mayer f
Figure 2. Maps between database instance and modes.
2.2. Algebraic manipulation
A set of algebraic operations is as follows: Definition 6. Based on the isomorphic subgraph property: Given a graph G, a query graph Q, said Q based property subgraph isomorphic to G, if there exists a function such : ( ( ) ( )) ( ( ) ( ))N Q N G E Q E G that the following conditions are true: ①Φ is a single-shot function. ② ( , ) ( )u v E Q , there is ( ( ), ( )) ( )u v E G ③ ( ), ( ) ( ( ))u N Q u u , and satisfy the predicate Q query graph on ()u property values. ④ ( ) ( ), ( ) ( ( ))e E Q e e , and satisfy the predicate Q query graph on ()e property values.
Referred to as QG Definition 7. The query graph match: Given a graph G, a query graph Q, in the subgraph isomorphism function φ attribute based Q matching in G is denoted ()Q G . Figure G may have a plurality of different sub-map and query graph match.
Definition 8. Choice: In GraMM, select the operation input, output figure collection. Given a set of graphs C, a query graph Q, select Options referred to as: ( ) { ( )|c C}QQCc
Options will return all matching to the sub-graph. Definition 9. Projection: Projection operation from one set of graphs to select certain vertices, edges on the C of each element. Projection operation referred to as: ( ) { [ ]| }A C c A c C
Which []cA represents derived from Figure c subgraph. Operating results for the same set of FIG. Example 1 query "What Taylor cooperation together with the female singer of songs" with algebraic operations can be written as: ( ( ))trackNode QCG
Wherein the query graph Q shown in Figure 1, G is a music database instance. This operation is the first operation to find and Q by selecting the sub-graph matching the figure from the database, and then use to get songs vertex projection operation. Definition 10. Portfolio consolidation: Given a set of graphs C and a set of graphs H, C and H and referred to as: { |c }C H c C c H
Where C, H having the same label, and all sessions of the equal value of the vertex (side) will be merged together. Definition 11. Set difference: Given a set of graphs C and a poor set of graphs H, C and H are referred to as: { |c }C H c C c H
Definition 12. Set of graphs Cartesian product: Given a set of graphs C and a set of graphs H, C and H of the Cartesian product of: { |c }C H c h C H ,h
Definition 13. Music content feature extraction: Feature extraction operation using the specified feature extraction method to obtain songs music content values. Feature extraction operation referred to as: ( , , ) { | ( ) ( )} extract extract extract extract extract Extract N N n n N n N Feature n n Where N is the set of vertices of a song with the same label, which has a type of vertex attributes and attribute values of a store songs feature some song content stored audio format. extract n is used to store the values of the vertices of the n extracted features, ()extractFeature n is a characteristic value of the property vertex extract n , ξ is the music feature extraction
methods.
Definition 14. Match of music content: Content matching operation uses the specified music content matching method to calculate the degree of match between songs. This operation is defined as: ( , , ) { | ( , ) }oMatch N n n N o n
Where o is the given sample song vertex, N is set to be matched songs vertices, δ is to calculate the degree of matching method, γ is matching. Matching operation method by δ, the N match the degree o of not less than γ song sample song vertex returned.
3. Music Query Language
In this section, the query language GraMQL is introduced based on the model GraMM. GraMQL contains data definition language and data process language.
3.1. Data definition language
First, the BNF syntax of the mode creating statement is introduced.
<create graph statement>::= C RE A T EG R A PH < graph name> <component list> <component list> ::= <component> [ { <component> }...] <component>::= <node type definition>|<edge type definition〉 |<extraction methods statement>|<similarity
methods statement>
|<similar note methods statement> <node type definition>::= NODE<node type name><attribute list> <edge type definition>::= EDGE<node type name><attribute list> {FROM<node type name>TO<node type name〉} <extraction methods statement >:: = EXTRACTIONMETHODS<methods list> <feature methods statement > ::= SIMILARITYMETHODS<methods list > <similar note methods statement>::= SIMILARNOTE<methods list ><attribute list>::=<attribute item>[ {< attribute item >}...] <methods list>::=<method item>[{<method item >)...] <attribute item> :: =<attribute type><attribute name>|: ID | <method item>:: =<method name>[: DEFUALT ]
By mode creating statement, GraMQL organizational structure provides the music data in the database, including vertex 1) The type of edge and their attributes appears in the music database; 2) Each type of edge can be connected to vertices; 3) Correlation algorithm could be used for processing music contents. After the schema definition, data manipulation on the model database instance needs to follow the pattern of conduct regulations.
3.2. Data process language
Data process language contains FIND, INSERT, EXTRACT, DELETE, etc. The definitions and the BNF syntaxes of them are as follows: FIND statement is used to search a database of all the query graph matching subgraphs. Users first need to build a query graph with the edges and vertices, and in which the query criteria is given , and then use this query diagram isomorphic subgraph to query based on attributes in the database. <find statement>::= FIND<element list>IN<graph name>[<where statement>] [<return statement>] <element list> ::= <element>[{<element>}...] <element> ::= <node> I <edge> <node> ::= NODE<node typo <node name>[<attributes>] <edge> ::= EDGE<edge type><edge name>[<attributes>] FROM<node name>TO<node name> <attributes> ::= <attribute> [{<attribute>)...] <attribute> ::=<attribute name> = <attribute value〉 <where statement>::=<similarity statement><music note statement〉 <return statement>::=RETURN<element list> INSERT statement is used to insert data to the database. <insert statement>::=INSERT<element list> INTO <graph name> DELETE statement is used to delete data from the database. <delete statement>::=DELETE<element list> EXTRACT statement is used to extract feature data. <extract statement>::=EXTRACT<music blob> INTO <feature blob> [USING<extraction method>] SIMILARITY statement is used to calculate the degree of similarity between music blobs. <similarity statement>::=SIMILARITY BETWEEN <music blob> AND < music blob >[USING<extraction method>]
Here is a case: Insert a new song named “A” to the singer “B”, the song was first sung on October 1, 2015.
FIND( NodeArtist artist(name=„B‟) ) IN musciDB INSERT( NODE Track newTrack(title=„A‟) Edge Sings (performanceTime = „2015.10.01‟) FROM artist TO newTrack )INTO musicDB
3.3. Query processing algorithm
Firstly, the following graph-based music Baseline data query algorithm framework. The Baseline algorithm based on the proposed algorithm Ullmann, adding support for music content pruning operations (row 2, lines 5-7, lines 17-18). Content Pruning algorithm called line 5 is a concrete implementation of the pruning algorithm music content.
In addition to music content is added to the operation in the query algorithms support, we propose to work with the main difference between the two lies in the optimization of existing work methods, in Chapter 3 of this article Query Optimization section will be described in detail In Algorithm 1, the second line of code to get the query graph vertices search order, as is the Baseline method, the order obtained here both queries in the order defined vertices; 3 lines of code to obtain default music content prune position, namely, music content prune (section 3.2 describes the optimization method) Searching for music content to the candidate point.
Function Search (G, Q, S, P, depth, M) , the first row first call Content Pruning (depth, M, p) function to determine whether the current search tree depth required properties according to the music content pruning shears plan branch. Line 11 and line 12, respectively, showing the structure pruning and pruning music meta data candidate point set here will use
neighbor vertex index and database features available statistical information (tag frequency). The first 13 lines to 20 lines, recursively try to match each candidate point. Line 17, if the current depth than just been pruned tree node depth is larger, then an ancestor of the current node branch has been pruned music content, so from the beginning of this ancestor node sub-tree will be subtracted , thereby reducing the size of the search space. It should be noted that, due to the method in Algorithm 1, music contents pruning positions not optimized, so the first 17 lines, 18 lines of code will not be executed to.
Algorithm 1: Music Subgraph Querying Input:Data graph G,Query graph Q Output:Subgraphs in G that are isomorphic to Q Boolean: this brunch can be pruned
1 S←GetSearchOrder(G,Q)//to be optimized
2 P←GetContentPruningPlan(S) // to be optimized
3 depth←0, M←
4 Search(G, Q, S, P, depth, M)
5 ifContentPruning(P, depth, M) then 6 return//this brunch should be pruned 7 endif 8 if depth=|N(Q)| then 9 report M and returntrue 10 n←S.nextQueryNode, Can←getCandidate(n) 11 refine Can by structure pruning 12 refine Can by meta pruning 13 for each m∈Cando 14 add m to M
15 Search(G, Q, S, P, depth+1, M)
16 remove m from M 17 if depth >P.justPrunedDepth do 18 return 19 end if 20 end for 21 return
Algorithm 2: ContentPruning Input: Search tree depth, Matched nodes Content pruning plan P Output: Nodes that should be pruned by content Boolean: this brunch can be pruned 1 indexes ←P. nodesToBeCheckAt(depth) 2 ifindexes ≠ then 3 for each i∈indexes do 4 ncon←M[i] 5 if content op has not been done on ncon then 6 do content op on ncon 7 end if 8 if ncon can be pruned by content then
9 P.justPrunedDepth← depth-1
10 return true 11 end if 12 end for 13 end if 14 return false
Algorithm 2 is a music content pruning algorithm execution, the process is as follows: First Line 1-2 determines whether the current search tree depth required music content prune plans, if any, need to perform music from the get all the content in the content pruning program P candidate vertex index operations.
Then the cycle is determined whether the content needs to be pruned every vertex has been defined predicate music content operations (line 5> If not, the operation is performed. Line 8 to determine whether the vertex music content can be pruned, if Yes, the current record prune depth and then return to inform top-level query algorithms.
4. Conclusion
A graph-based music data model named Gra-MM to model music data with complicated relationships is presented in this paper. The definition of model‟s logical data structure and algebraic operations are given. Then based on Gra-MM, this paper present a music data query language called Gra-MQL, giving the BNF syntax in the language. Gra-MQL can handle the complicated relationships among music data well, and also has the ability to query music by meta data as well as music content data, which meets the demands of various users and overcomes the shortcomings of traditional graph query languages which do not have adequate expressive power when dealing with data that have complicated relationships and don‟t have the ability to query music based on music content data.